-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenMP detection with Clang is broken in 2.6.0 #740
Comments
Is your Clang installed by package manager or self-built? |
So I understand you want to mix LLVM (clang) for C/C++ and GNU (gfortran) for Fortran compilers. As you pointed out, in this way you mix the two OpenMP runtimes (libomp and libgomp, respectively), which is not good (see for example https://cpufun.substack.com/p/is-mixing-openmp-runtimes-safe ). For the same reason, the proposed solution would not work (here we have gfortran in the game). |
@alazzaro Thank you for responding! It is not really I want, it is Macports default setting for Intel and arm64. I would be happy to avoid Clangs altogether and use GCC, like I do on PowerPC systems. But it is not something I can decide globally. To be honest I am not sure which OpenMP library gfortran links to (if to any at all) on systems using Clangs. I can check that. In practical terms using Clang with gfortran seems to work fine (configure problems aside). |
Well, @dev-zero suggested a way to avoid the OpenMP C and C++ if we don't use ACCEL and C_API... I will try to implement it. For the DBCSR problem, I would like to enforce a better way to link OpenMPI libraries in DBCSR, but again this is not your primary issue... Of course, it would be great if we can use flang for compiling DBCSR, but it doesn't work yet... |
gfortran links with the runtime included in the gcc distribution. I do not know if it is possible to change it. Clang might offer the possibility to switch between clang openmp runtime and the gcc implementation. Mixing the two implementations is surely not going to work in the long run if it even run at all (we tried). according to the CMakeLists.txt, |
Unfortunately no, even if C/C++ is not used, the findOpenMP still check for C and C++ OpenMP libraries... Need to protect for that case. Concerning OpenMP runtime in clang, as far as I know, libomp is the only supported (see https://openmp.llvm.org/design/Runtimes.html#openmp-runtimes ). Then, as pointed out at https://cpufun.substack.com/p/is-mixing-openmp-runtimes-safe , you can use libomp with gcc linking... |
@mascguy @eborisch @cjones051073 Could someone please clarify how is our OpenMP supposed to work when Clang is used (with/without MPICH) and also Gfortran is? Which will be the case with almost everything on x86 and aarch64. I.e., Clang is linking to |
it is very risky to mix both runtimes. I would really advice against. Hint here https://cpufun.substack.com/p/is-mixing-openmp-runtimes-safe the findopenmp issue is solved with this
by default |
@mtaillefumier yes, that's what Alfio and I have already planned: switch to requiring only the Fortran component, and the others only iff accelerator or C API is requested. |
@dev-zero Got it, thank you. I have switched |
Adding this sort of fix works: ValerioMagnago/moveit@46d318b
(perhaps only
libomp
is relevant for Clang, others can be dropped).The text was updated successfully, but these errors were encountered: