Fix CRKSPH OpenCL kernel compilation - #439
Open
lililii124 wants to merge 1 commit into
Open
Conversation
Avoid invalid casts and OpenCL builtin overload conflicts; add CPU/OpenCL numerical regression coverage. Fixes pypr#378.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The default CRKSPH scheme in
kelvin_helmholtz_instability --openclfails to build its generated OpenCL kernels. This change removes the invalid Python-style casts ingj_solve, uses floating-point bounds in the momentum and energy limiters, and computes the sound speed withsqrtto avoid an ambiguouspowoverload.The array dot-product helper is named
dot_productto avoid colliding with OpenCL's built-indot. CRKSPH and MAGMA2 helper registrations and calls use the new name;dotremains an alias for existing Python callers.The regression test compiles and executes both CRKSPH equation stages and compares density, pressure, sound speed, correction coefficients/gradients, acceleration and energy rate against Cython. It covers single and double precision, skipping double precision on devices without FP64 support.
Validation on Windows, Python 3.11, Compyle 0.9.1, and Intel UHD Graphics 730:
BUILD_PROGRAM_FAILUREwith invalidfloat(...)expressions and ambiguousmincalls.python -m pytest pysph/sph/tests/test_linalg.py pysph/sph/tests/test_kernel_corrections.py pysph/sph/tests/test_crksph.py -q: 31 passed, 1 skipped (FP64 unsupported on this GPU).python -m pysph.examples.gas_dynamics.kelvin_helmholtz_instability --opencl --max-steps 2 --disable-output -d <output-directory>: completed successfully with 47,524 particles including periodic ghosts.git diff --check: passed.Double-precision execution could not be verified locally: the alternative Intel CPU OpenCL runtime terminates with an internal compiler error. The FP64 regression case is included for supported CI devices. The example run is a two-step smoke test, not a long-duration validation of the physical solution.
Fixes #378.