forked from lijiext/lammps
rename and document script to automatically convert 'default(none)' to 'default(shared)' OpenMP pragmas
This commit is contained in:
parent
ac7d74f2a5
commit
eb8a6512e2
|
@ -116,6 +116,18 @@ enables OpenMP. For GNU compilers it is -fopenmp. For (recent) Intel
|
||||||
compilers it is -qopenmp. If you are using a different compiler,
|
compilers it is -qopenmp. If you are using a different compiler,
|
||||||
please refer to its documentation.
|
please refer to its documentation.
|
||||||
|
|
||||||
|
[OpenMP Compiler compatibility info]: :link(default-none-issues)
|
||||||
|
|
||||||
|
Some compilers do not fully support the 'default(none)' directive
|
||||||
|
and others (e.g. GCC version 9 and beyond) may implement OpenMP 4.0
|
||||||
|
semantics, which are incompatible with the OpenMP 3.1 directives used
|
||||||
|
in LAMMPS (for maximal compatibility with compiler versions in use).
|
||||||
|
In those case, all 'default(none)' directives (which aid in detecting
|
||||||
|
incorrect and unwanted sharing) can be replaced with 'default(shared)'
|
||||||
|
while dropping all 'shared()' directives. The script
|
||||||
|
'src/USER-OMP/hack_openmp_for_pgi_gcc9.sh' can be used to automate
|
||||||
|
this conversion.
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
Choice of compiler and compile/link options :h4,link(compile)
|
Choice of compiler and compile/link options :h4,link(compile)
|
||||||
|
|
|
@ -932,7 +932,9 @@ LINKFLAGS: -fopenmp # for GNU Compilers
|
||||||
LINKFLAGS: -qopenmp # for Intel compilers on Linux :pre
|
LINKFLAGS: -qopenmp # for Intel compilers on Linux :pre
|
||||||
|
|
||||||
For other platforms and compilers, please consult the documentation
|
For other platforms and compilers, please consult the documentation
|
||||||
about OpenMP support for your compiler.
|
about OpenMP support for your compiler. Please see the note about
|
||||||
|
how to address compatibility "issues with the 'default(none)'
|
||||||
|
directive"_Build_basics.html#default-none-issues of some compilers.
|
||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
for f in *.h *.cpp
|
|
||||||
do \
|
|
||||||
sed -e '/#pragma omp/s/^\(.*default\)(none)\(.*\)$/\1(shared)\2/' \
|
|
||||||
-e '/#pragma omp/s/shared([a-z0-9,_]\+)//' \
|
|
||||||
-i.bak $f
|
|
||||||
done
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# convert default(none) directives for OpenMP pragmas to default(shared) and remove shared() directive
|
||||||
|
# this allows compiling OpenMP pragmas in LAMMPS with compilers that don't support default(none) properly
|
||||||
|
# or require backward incompatible OpenMP 4 and OpenMP 5 semantics
|
||||||
|
|
||||||
|
for f in *.h *.cpp
|
||||||
|
do \
|
||||||
|
sed -e '/#pragma omp/s/^\(.*default\)(none)\(.*\)$/\1(shared)\2/' \
|
||||||
|
-e '/#pragma omp/s/shared([a-z0-9,_]\+)//' \
|
||||||
|
-i.bak $f
|
||||||
|
done
|
Loading…
Reference in New Issue