Skip to content

Commit d2c5ff5

Browse files
authored
Merge pull request #665 from pbartholomew08/patch-2
Add CMake OpenMP link instructions gpu.md
2 parents c8a0851 + 33e095d commit d2c5ff5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/user-guide/gpu.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,19 @@ fail to compile with some compilers. Under `PrgEnv-cray` an explicit
217217
description of supported OpenMP features can be viewed using the
218218
command `man intro_openmp`.
219219

220+
##### Compiling with CMake
221+
222+
When using the `CMake` build system with the Cray/GPU compilers the generated
223+
link line may not correctly link OpenMP - see https://gitlab.kitware.com/cmake/cmake/-/issues/26129.
224+
A potential solution is to add code equivalent to:
225+
226+
```
227+
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Cray")
228+
target_link_options(<target> INTERFACE -h omp)
229+
endif()
230+
```
231+
232+
to your CMake program (C/C++ linkers should use `-fopenmp`).
220233

221234
#### HIP
222235

0 commit comments

Comments
 (0)