blt icon indicating copy to clipboard operation
blt copied to clipboard

Serac: Problem with OpenMP + CUDA

Open samuelpmishLLNL opened this issue 3 years ago • 1 comments

In serac, we're running into compilation issues on OpenMP targets when CUDA is enabled. The actual error is:

g++: error: unrecognized command line option ‘-fopenmp=libomp’

It looks like this flag is coming from https://github.com/LLNL/blt/blob/develop/cmake/thirdparty/SetupOpenMP.cmake which tries to manually manage compilation flags of targets that use OpenMP.

In my experience, CMake's built-in OpenMP target works pretty well (and it does not have these issues), so I think it would be beneficial to try using that directly instead of duplicating the effort in BLT.

An example CMake project that uses CUDA + OpenMP together is available here:

https://github.com/samuelpmishLLNL/openmp_cuda_example_project

it shows how to optionally enable CUDA language support, how to install the library, and how to use it as a subdirectory from another library as well.

samuelpmishLLNL avatar Aug 01 '22 20:08 samuelpmishLLNL

I agree, most folks are using new enough CMake (3.9+) that directly using openmp targets is best solution, here is how we handle this in ascent:

https://github.com/Alpine-DAV/ascent/blob/a349f0aef1868b123da233756f80a0d9ac65374b/src/cmake/SetupBLT.cmake#L79

cyrush avatar Aug 03 '22 16:08 cyrush