-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 problem with static library - Windows #3069
Comments
Please try adding |
Unfortunately it does not work, as it seems not able to find Fortran OPENMP:
I will try to make it work with ICC and IFortran, as they are now freely available. |
Not intended by us here, but apparently a feature of flang (or perhaps even llvm and llvm-derived compilers in general) |
From TriBITSPub/TriBITS#244 (comment) the Fortran-OpenMP misdetection appears to be a problem in certain versions of cmake |
Does it work with CMake from visual studio installer? |
It requires an update of the ninja builder (does not support fortran), but after that yields exactly the same results. The fix suggested :
fixes the configuration step for the USE_OPENMP=1, but the build fails. For instance I get:
|
Just realized that the version of flang and clang-cl installed by miniconda are very old (LLVM 5). Probably that might part of the issue. Compilation with the new oneAPI intel compilers (icl and ifx) are not supported for now by cmake but it seems they are in the works: |
OpenBLAS does not replace cmake detection of C and fortran compilers. If miniconda ships broken combination of those, it cannot be solved here. More straightforward approach would be to get clang-cl and flang via official LLVM download (Probably waiting a day or two for v11.0.1 to get pushed to download page), and trying to tame cmake from visual studio, failing that installing official cmake binary. |
@brada4 Yes probably it would be correct to do so, |
Early versions when flang was outside llvm main tree did work, crashing often though, probably anaconda includes something atound that. |
There's a difference between the old flang compiler, which was repackaged by conda-forge, and the f18-renamed-to-flang compiler as it exists in llvm, see: https://github.com/llvm/llvm-project/tree/master/flang#flang This newer compiler does not yet support compiling code:
But then, flang was also only added for LLVM 11. Both the code generation, as well as windows support, are actively being pursued. |
Gfortran would mix in gomp redist. Maybe it is possible to get it to link instead to ms-omp or iomp, lfortran is different independent project, with primary distribution channel via anaconda.. |
As one of the creators of that windows compiler, I decided that it would be a better use of my time to wait until the llvm developers added windows support officially rather than spent time maintaining a parallel compiler. It is possible to use with openmp though. |
I actually have an updated version. Let me see how much time it would take to get it working... |
Drop a line here, there are FAQ sections to get users past disappointment with tricky build environments. |
The flang compiler itself needs the |
Well, I did manage to update flang to llvm 11, but ran into #3084. |
@vincferr I built OpenBLAS with LLVM 11. Are you interested? |
update: when attempting to compile with OpenMP, I received this error:
Checking the upstream version, flang-compiler/flang#904, it appears this isn't my fault. I'm also not capable currently of implementing this feature in the flang compiler. Therefore, it appears that it's not possible to use OpenMP with OpenBLAS on windows. |
Hm. That is from Reference-LAPACK and the OpenBLAS version has it ifdef'd requiring the compiler to announce _OPENMP >= 201307 compatibility. If flang makes a false claim here I could add another conditional to keep it from parallelizing this particular loop. |
It is a warning. I'd trust them that it means no parallelism and correct result as a consequence |
The error is my fault. It's an ICE, I have to track it down. |
note: I published it to https://github.com/xoviat/flang/tree/windows |
note: this issue has been resolved in flang upstream. there should be a new version out today or tomorrow that resolves the issue. no changes to OpenBLAS are required. |
I am trying to move a project, compiled with VS 16.8.4 and MSVC, from Intel MKL to OpenBLAS.
I have been following the instructions on
https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio
and they worked quite ok, with the sole addition of -DMSVC_STATIC_CRT=ON as option, to avoid linking problem when /MT is employed.
The annoying fact is that, when I use the libs in my project, compiled via MSVC, at linking time it requires to link against (beside the Fortran stuff)
ompstub.lib
and at run time it requires
ompstub.dll
This seems to modify the behaviour of my code, as now omp_get_max_threads() returns 1.
Any clue on why that happens?
This seems to happen with develop and v.0.3.13 alike.
Moreover I get this warning while linking:
3>LINK : warning LNK4098: defaultlib 'msvcrt' conflicts with use of other libs; use /NODEFAULTLIB:library
but it is mostly due to the fact that OpenBLAS is compiled with clang-cl, I guess,
The option I pass to cmake are:
cmake .. -G "Ninja" -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_Fortran_COMPILER=flang -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DDYNAMIC_ARCH=ON -DCMAKE_BUILD_TYPE=Release -DMSVC_STATIC_CRT=ON -DCPP_THREAD_SAFETY_GEMV=ON
The text was updated successfully, but these errors were encountered: