Skip to content

Conversation

@ChrisJD-VMC
Copy link

@ChrisJD-VMC ChrisJD-VMC commented Jan 26, 2026

Fixes - Could NOT find OpenMP_CUDA (missing: OpenMP_CUDA_FLAGS OpenMP_CUDA_LIB_NAMES)

This is a fix for #124 The original solution to the issue was to stay on a specific cmake version. That's inconvenient. This fixes the problem so that newer versions of cmake work correctly. It is based on the discussion and solution found at NVIDIA/cuda-samples#333.

I've tested it with cmake 4.2 and CUDA Toolkit 12.9 on Windows with VS 2022, but that thread indicates it resolves the problem in 3.31, 4.0 and 4.1 (on arch linux).


find_package(CUDA 11.7 REQUIRED)
find_package(OpenMP REQUIRED)
find_package(OpenMP REQUIRED C CXX)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requiring the C component is unnecessary and introduces unnecessary dependencies that caused grief in some environments I had to build for.

Explicitly using the "COMPONENTS" key word is technically optional, but improves readability.

Suggested change
find_package(OpenMP REQUIRED C CXX)
find_package(OpenMP REQUIRED COMPONENTS CXX)

Copy link
Author

@ChrisJD-VMC ChrisJD-VMC Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct, I tested it without the C and it still works. It's obviously just the missing CXX that causes the problem. I've amended the PR

…A_LIB_NAMES)

This is a fix for llnl#124
The solution to the issue originally was to stay on a specific cmake version. That's inconvenient. This fixes the problem so that newer versions of cmake work correctly. It is based on the discussion and solution found at NVIDIA/cuda-samples#333.

I've tested it with cmake 4.2 and CUDA Toolkit 12.9 on Windows, but that thread indicates it resolves the problem in 3.31, 4.0 and 4.1 (on arch linux).
@ChrisJD-VMC ChrisJD-VMC force-pushed the fix-missing-OpenMP_CUDA_FLAGS branch from 4cb1e17 to 7cb63b5 Compare January 26, 2026 23:02
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.

2 participants