Skip to content

Conversation

@smithsg84
Copy link
Member

@smithsg84 smithsg84 commented Nov 20, 2025

Fix for compilation failure when downstream library/application is built without OpenMP (SYCL) when RAJA was installed with OpenMP (SYCL).

This was tested by compiling example RAJA applications from the RAJA/examples directory against RAJA installed with different options. Also tested compiling RAJAPerSuite without OMP (SYCL) against RAJA built with OMP (SYCL).

For discussion:

Steve is very concerned this simple fix does not fully address the all the issues. There is a violation of C++ ODR principle by having compilation of the same functions / structures be controlled by each RAJA library. If two libraries are built, say the "with-OMP" library and the "without-OMP" library and then linked together into a single RAJA app the functions / data structures with the #if defined(RAJA_OPENMP_ACTIVE) preprocessor logic will be different.

Example for problematic conditional logic:
https://github.com/LLNL/RAJA/blob/85e009758125c97717f1d637a90520839280b8a5/include/RAJA/policy/cuda/MemUtils_CUDA.hpp#L209

Possible fix would be to template on the presences/absence of OpenMP to disambiguate rather then preprocessor. Steve not sure ramifications of doing a template fix.

@rhornung67
Copy link
Member

@smithsg84 please note that LC GitLab CI checks will not run on a PR that is in draft stage; therefore, the PR cannot be merged. If you want this to go through all CI checks, please click the "Ready for review" button.

@smithsg84 smithsg84 marked this pull request as ready for review November 20, 2025 22:37
@smithsg84 smithsg84 changed the title DRAFT: Bugfix/smith84/1754 openmp Bugfix/smith84/1754 openmp Nov 20, 2025
@adayton1
Copy link
Member

Do we know why omp::mutex was used instead of std::mutex to begin with? Was the omp version more performant?

@rhornung67
Copy link
Member

I do not know. That code was developed at a time when the dpc++ compiler was being shaken out in terms of SYCL support. Maybe that was related to the choice.

@rhornung67
Copy link
Member

@smithsg84 I fixed the code formatting issues and restarted the CI checks on this. Everything is green. Is it good to merge?

@rhornung67
Copy link
Member

Folks, while this PR doesn't address all the issues, it is an improvement. We will make an issue for future work to be done. It is ready to merge. Please review.

@smithsg84 smithsg84 merged commit 408877b into develop Dec 11, 2025
20 checks passed
@MrBurmark MrBurmark deleted the bugfix/smith84/1754-openmp branch December 12, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't require downstream projects to enable OpenMP

6 participants