Skip to content

Commit ad53b72

Browse files
authored
Merge pull request #2632 from mgorny/openmp-update
KB: attempt updating the OpenMP documentation
2 parents 60958a2 + d621792 commit ad53b72

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

docs/maintainer/knowledge_base.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,14 +1162,21 @@ corresponding compilers in `requirements/build` as normal.
11621162

11631163
### OpenMP
11641164

1165-
You can enable OpenMP on macOS by adding the `llvm-openmp` package to the `build` section of the `meta.yaml`.
1166-
For Linux OpenMP support is on by default, however it's better to explicitly depend on the libgomp package which is the OpenMP
1167-
implementation from the GNU project.
1165+
The default OpenMP runtime used depends on the compiler and platform used. GCC (on Linux and the Windows MinGW
1166+
toolchain) uses the `libgomp` runtime. Clang (on all platforms) and GNU Fortran on macOS default to the `llvm-openmp`
1167+
runtime. MSVC may use its own runtime or `llvm-openmp`. However, individual projects may force building against
1168+
a different runtime through their build system configuration.
1169+
1170+
On Linux, building against `libgomp` is recommended as the other OpenMP providers are backwards compatible with it.
1171+
When packages are built against `libgomp`, it is possible to use both `libgomp` and `llvm-openmp` provider at runtime.
1172+
1173+
Dependencies on OpenMP providers belong in the `host` section of recipe dependencies. The following snippet corresponds
1174+
to the defaults, though individual packages may require a different set:
11681175

11691176
```yaml
11701177
# meta.yaml
11711178
requirements:
1172-
build:
1179+
host:
11731180
- llvm-openmp # [osx]
11741181
- libgomp # [linux]
11751182
```
@@ -1181,7 +1188,10 @@ requirements:
11811188
On macOS, only LLVM's OpenMP implementation `llvm-openmp` is supported. This implementation is used even in Fortran code compiled
11821189
using GNU's gfortran.
11831190

1184-
On Linux (except aarch64), packages are linked against GNU's `libgomp.so.1`, but the OpenMP library at install time can be
1191+
On Windows, switching between different OpenMP implemnentations is not supported. Every package uses the implementation
1192+
it was built against.
1193+
1194+
On Linux, when packages are linked against GNU's `libgomp.so.1`, the OpenMP library at install time can be
11851195
switched from GNU to LLVM by doing the following.
11861196

11871197
```shell-session

0 commit comments

Comments
 (0)