Skip to content

Support top-bottom y stretching in the OpenMP 010 Poisson solver - #491

Open
kaanolgu wants to merge 6 commits into
mainfrom
omp-poisson-010-stretched
Open

kaanolgu wants to merge 6 commits into
mainfrom
omp-poisson-010-stretched

Conversation

@kaanolgu

@kaanolgu kaanolgu commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #388

Add top-bottom y stretching to the OpenMP Poisson solver for the 010 case (periodic x and z, non-periodic y). On main, init_omp stops every OpenMP run that has a stretched y mesh

  • Add process_spectral_010_fw, process_spectral_010_poisson and process_spectral_010_bw to the OpenMP spectral kernels. The pentadiagonal solve is a port of the CUDA kernel
  • Solve the odd and the even y modes on one rank and on many ranks with a z split (p_col > 1). On many ranks the solve uses the y-pencil, so init_omp builds the stretching matrices for the y-pencil block
  • Keep the abort for centred and bottom stretching. A y decomposition (p_row > 1) still stops in init_buffers_010
  • Register test_poisson_bc --bc pdp --stretch top-bottom for OpenMP on 1 and 2 ranks
  • Register the channel_smoke regression case for OpenMP on 1 rank

The PR also moves the forward and backward steps of process_spectral_010 into the new kernels. The uniform results do not change. The uniform channel monitoring.csv is identical before and after the change

All runs below use double precision. The channel case is tests/regression/channel_smoke.x3d with 20 iterations, n_output = 1 and no initial noise. The 2-rank OpenMP run splits z. The table gives the maximum difference over the 21 rows of monitoring.csv

Quantity OpenMP 1 rank vs CUDA OpenMP 2 ranks vs OpenMP 1 rank
Kinetic energy (relative) 0 0
Enstrophy (relative) 8.9e-13 8.9e-13
div_u_max (absolute) 1.8e-16 1.4e-16

At step 20 all three runs give a kinetic energy of 0.1434179634725 and an enstrophy of 1.125300909082. The div_u_max values are 5.9e-17 (OpenMP, 1 rank), 7.3e-18 (OpenMP, 2 ranks) and 9.8e-17 (CUDA)

The table gives the errors of test_poisson_bc --bc pdp --stretch top-bottom on the 64x65x64 grid

Check OpenMP 1 rank OpenMP 2 ranks CUDA
div(grad p), COS_X n=2 1.20e-12 1.19e-12 7.0e-14
div(grad p), COS_Y n=2 5.15e-12 5.10e-12 1.53e-12
div(grad p), COS_XY n=2 3.67e-12 3.66e-12 8.1e-14
Round trip 1.50e-14 1.49e-14 1.0e-15
Random div(u) 1.81e-14 1.74e-14 1.3e-15

All checks pass on the three runs. The error against the analytic solution is the same on the three runs. The OpenMP div(grad p) errors are up to 45 times larger than the CUDA errors, but all of them are less than 6e-12. The uniform test_poisson_bc --bc pdp case shows a gap of the same size, so the stretched solve does not cause it

Check (uniform, no stretching) OpenMP 1 rank CUDA
div(grad p), COS_X n=2 5.0e-12 2.5e-13
div(grad p), COS_Y n=2 3.8e-12 9.0e-14
Round trip 1.8e-14 7.8e-16

The golden file channel_smoke_golden_omp.csv gives the same result from two separate builds. In double precision and in single precision, ctest -L omp passes all 75 tests. On CUDA, the regression_channel and test_poisson_bc tests pass

@kaanolgu
kaanolgu marked this pull request as draft November 13, 2026 15:05
@ia267 ia267 added the enhancement New feature or request label Nov 18, 2026
@ia267 ia267 added this to the Version 0.1.0 milestone Nov 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Channel (010) case y-stretching for multi CPU [OpenMP]

2 participants