diff --git a/applications/test/openmp/Make/options b/applications/test/openmp/Make/options index 54eed51fb98aec99bde724a061aff18cbc2c3e76..9c1cb59980fc47cffd7dac5118ab031247ab6c36 100644 --- a/applications/test/openmp/Make/options +++ b/applications/test/openmp/Make/options @@ -1,4 +1,4 @@ -EXE_INC = ${COMP_OPENMP} +EXE_INC = ${COMP_OPENMP} /* -UUSE_OMP */ /* Mostly do not need to explicitly link openmp libraries */ /* EXE_LIBS = ${LINK_OPENMP} */ diff --git a/applications/test/openmp/Test-openmp.C b/applications/test/openmp/Test-openmp.C index acb68e9ed86d6d6d96f131370dfbea08e6c39a27..1ac9762c7633ca105334c829f40da30e12e52bc8 100644 --- a/applications/test/openmp/Test-openmp.C +++ b/applications/test/openmp/Test-openmp.C @@ -30,7 +30,7 @@ Description #include <cstdlib> #include <iostream> -#ifdef USE_OMP +#if _OPENMP #include <omp.h> #endif @@ -39,11 +39,19 @@ Description int main(int argc, char *argv[]) { +#if USE_OMP + std::cout << "USE_OMP defined (" << USE_OMP << ")\n"; +#else + std::cout << "USE_OMP undefined\n"; +#endif + +#if _OPENMP + std::cout << "_OPENMP = " << _OPENMP << "\n\n"; + + // Fork threads with their own copies of variables int nThreads, threadId; -// Fork threads with their own copies of variables -#ifdef USE_OMP -#pragma omp parallel private(nThreads, threadId) + #pragma omp parallel private(nThreads, threadId) { threadId = omp_get_thread_num(); nThreads = omp_get_num_threads(); diff --git a/etc/config.csh/settings b/etc/config.csh/settings index 4c88b294b839bfb3125a2fee651e780af2924ad6..37c49f4e91dad3c268810d5b4116897cbc4f783a 100644 --- a/etc/config.csh/settings +++ b/etc/config.csh/settings @@ -302,6 +302,7 @@ CLANG_NOT_FOUND _foamAddMan $clangDir/man _foamAddPath $clangDir/bin + _foamAddLib $clangDir/lib # For things like libomp (openmp) etc if ($?FOAM_VERBOSE && $?prompt) then echo "Using ThirdParty compiler" diff --git a/etc/config.sh/settings b/etc/config.sh/settings index 286339aa5364583b965046ab0c1dbaf38ad762e3..33aa7fa89376e2548b6fafbf71c4c1fe5043f026 100644 --- a/etc/config.sh/settings +++ b/etc/config.sh/settings @@ -287,6 +287,7 @@ CLANG_NOT_FOUND _foamAddMan $clangDir/share/man _foamAddPath $clangDir/bin + _foamAddLib $clangDir/lib # For things like libomp (openmp) etc if [ "$FOAM_VERBOSE" -a "$PS1" ] then diff --git a/wmake/rules/linux64Clang/openmp b/wmake/rules/linux64Clang/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..070a2c5d3ad0b2ef0b54b458bffa78b8ac915812 100644 --- a/wmake/rules/linux64Clang/openmp +++ b/wmake/rules/linux64Clang/openmp @@ -1,4 +1,8 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) +# - +# Clang provides 'omp' and a link for 'gomp'. +# With 'gomp' we can use system libs. COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linux64Cray/openmp b/wmake/rules/linux64Cray/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..cd007d152913387c2d85d48b65478cbcff769b71 100644 --- a/wmake/rules/linux64Cray/openmp +++ b/wmake/rules/linux64Cray/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linux64Gcc/openmp b/wmake/rules/linux64Gcc/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..cd007d152913387c2d85d48b65478cbcff769b71 100644 --- a/wmake/rules/linux64Gcc/openmp +++ b/wmake/rules/linux64Gcc/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linux64GccKNL/openmp b/wmake/rules/linux64GccKNL/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..cd007d152913387c2d85d48b65478cbcff769b71 100644 --- a/wmake/rules/linux64GccKNL/openmp +++ b/wmake/rules/linux64GccKNL/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linux64Icc/openmp b/wmake/rules/linux64Icc/openmp index 154c9e5743dae699e2dc6c25111dbe4846113030..738673ca91cc2f2f3f4e4e44cba92db23858d469 100644 --- a/wmake/rules/linux64Icc/openmp +++ b/wmake/rules/linux64Icc/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -qopenmp LINK_OPENMP = -liomp5 diff --git a/wmake/rules/linux64IccKNL/openmp b/wmake/rules/linux64IccKNL/openmp index 154c9e5743dae699e2dc6c25111dbe4846113030..738673ca91cc2f2f3f4e4e44cba92db23858d469 100644 --- a/wmake/rules/linux64IccKNL/openmp +++ b/wmake/rules/linux64IccKNL/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -qopenmp LINK_OPENMP = -liomp5 diff --git a/wmake/rules/linuxARM64Clang/openmp b/wmake/rules/linuxARM64Clang/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..070a2c5d3ad0b2ef0b54b458bffa78b8ac915812 100644 --- a/wmake/rules/linuxARM64Clang/openmp +++ b/wmake/rules/linuxARM64Clang/openmp @@ -1,4 +1,8 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) +# - +# Clang provides 'omp' and a link for 'gomp'. +# With 'gomp' we can use system libs. COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linuxARM64Gcc/openmp b/wmake/rules/linuxARM64Gcc/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..cd007d152913387c2d85d48b65478cbcff769b71 100644 --- a/wmake/rules/linuxARM64Gcc/openmp +++ b/wmake/rules/linuxARM64Gcc/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linuxARM7Gcc/openmp b/wmake/rules/linuxARM7Gcc/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..cd007d152913387c2d85d48b65478cbcff769b71 100644 --- a/wmake/rules/linuxARM7Gcc/openmp +++ b/wmake/rules/linuxARM7Gcc/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linuxClang/openmp b/wmake/rules/linuxClang/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..070a2c5d3ad0b2ef0b54b458bffa78b8ac915812 100644 --- a/wmake/rules/linuxClang/openmp +++ b/wmake/rules/linuxClang/openmp @@ -1,4 +1,8 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) +# - +# Clang provides 'omp' and a link for 'gomp'. +# With 'gomp' we can use system libs. COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linuxGcc/openmp b/wmake/rules/linuxGcc/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..cd007d152913387c2d85d48b65478cbcff769b71 100644 --- a/wmake/rules/linuxGcc/openmp +++ b/wmake/rules/linuxGcc/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linuxIA64Gcc/openmp b/wmake/rules/linuxIA64Gcc/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..cd007d152913387c2d85d48b65478cbcff769b71 100644 --- a/wmake/rules/linuxIA64Gcc/openmp +++ b/wmake/rules/linuxIA64Gcc/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linuxIA64Icc/openmp b/wmake/rules/linuxIA64Icc/openmp index 154c9e5743dae699e2dc6c25111dbe4846113030..738673ca91cc2f2f3f4e4e44cba92db23858d469 100644 --- a/wmake/rules/linuxIA64Icc/openmp +++ b/wmake/rules/linuxIA64Icc/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -qopenmp LINK_OPENMP = -liomp5 diff --git a/wmake/rules/linuxPPC64Gcc/openmp b/wmake/rules/linuxPPC64Gcc/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..cd007d152913387c2d85d48b65478cbcff769b71 100644 --- a/wmake/rules/linuxPPC64Gcc/openmp +++ b/wmake/rules/linuxPPC64Gcc/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp diff --git a/wmake/rules/linuxPPC64leGcc/openmp b/wmake/rules/linuxPPC64leGcc/openmp index bcb805f57c6240bc577b1f04208ac09706d0846a..cd007d152913387c2d85d48b65478cbcff769b71 100644 --- a/wmake/rules/linuxPPC64leGcc/openmp +++ b/wmake/rules/linuxPPC64leGcc/openmp @@ -1,4 +1,5 @@ # Flags for compiling/linking openmp +# The USE_OMP is for OpenFOAM-specific use (general use is _OPENMP) COMP_OPENMP = -DUSE_OMP -fopenmp LINK_OPENMP = -lgomp