Skip to content

Commit a90b6d1

Browse files
committed
KB: attempt updating the OpenMP documentation
Attempt to make the OpenMP entry in the Knowledge Base clearer. Notably: - avoid suggesting that OpenMP gets enabled automatically (apparently this was the case up to gfortran-9, but not anymore) -- now it needs to be enabled by packages explicitly - indicate which implementations are used by default but make it clear that different packages may be forcing other implementations - explicitly recommend building against libgomp on Linux - fill Windows support in Signed-off-by: Michał Górny <mgorny@quansight.com>
1 parent 4b4005f commit a90b6d1

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

docs/maintainer/knowledge_base.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,9 +1162,16 @@ 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.
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 `build` 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
@@ -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`, but 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)