-
Notifications
You must be signed in to change notification settings - Fork 1.6k
OpenBLAS build for Win x86 with cmake + VC fails when -DDYNAMIC_ARCH=ON #2826
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
Comments
You certainly missed to mention what the "some error" messages are... |
Definitely I've missed, because I'm facing some strange behavior so I don't know what to attach Now I've received the full error list: |
That seems to be the same error as in #2746, somehow the preprocessor does not get run or does not insert the relevant constants e.g. for the size of "subbuffer" into the source files before compiling. (In #2746 I had assumed it was a problem with the build system not working with the Intel compiler, but perhaps this is/was actually an x86 build problem as well.) Offhand I do not see why x86 should behave differently, I will see if I can reproduce this. |
DYNAMIC_ARCH is not supported when building with Visual Studio compilers since the compiler doesn't understand the assembly syntax used in OpenBLAS. You can only build the |
Thanks for support! Also is there any other way to build x86 to use the static lib with VS? |
yes |
Of course... where's my head today ? |
I didn't know this, maybe it will be nice to highlight that line in build page for x86. Ok guys, thank you very much for your support, I was able to successfully build the lib by removing DYNAMIC_ARC and adding -DTARGET=generic to my build command. |
Is there any way to build x86 like it was done for x64?
As with VS build version I see significant performance loss, about 5x times worse compared to #1 build for x64 |
You can, but you'll have to disable LAPACK and LAPACKE. Are you using BLAS and CBLAS only? |
Yes, I'm using BLAS only for x64 I did with the following configuration 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 and it works well, but the same I've tried by setting VS tools for x86 and providing -A Win32 to cmake but it failed to configure |
The following error I received for x86: cmake .. -G "Ninja" -A Win32 -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
does not support platform specification, but platform
was specified. CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage |
The same build command line should work. (You don't need |
ok thanks, I will try one more time without -A Win32 and making sure to activate x86. |
The following I did: "c:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Auxiliary/Build/vcvars32.bat" ** Visual Studio 2017 Developer Command Prompt v15.9.24 [vcvarsall.bat] Environment initialized for: 'x86' 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
is not able to compile a simple test program. It fails with the following output:
|
Can you do the following,
clean the |
I've cleaned the build directory, set above mentioned variables and run the same command, here is the result: The Fortran compiler
is not able to compile a simple test program. It fails with the following output:
|
You need to do the following to disable fortran
|
ok, now it passed some steps and now fails with the following: FAILED: cmTC_3fd63.exe cmd.exe /C "cd . && C:\Users\Admin\anaconda3\Library\bin\cmake.exe -E LINK: command CMakeFiles\cmTC_3fd63.dir\cpuid.S.obj : fatal error LNK1112: module machine |
Can you clean and rebuild with |
Sure, here is the results: cmake .. -G "Ninja" -DVERBOSE=1 -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DBUILD_WITHOUT_LAPACK=yes -DNOFORTRAN=1 -DDYNAMIC_ARCH=ON -DCMAKE_BUILD_TYPE=Release -- Looking for stdatomic.h Quoted variables like "MSVC" will no longer be dereferenced when the policy CMake Error at cmake/prebuild.cmake:533 (MESSAGE): Run Build Command(s):C:/Users/Admin/anaconda3/Library/bin/ninja.exe [2/3] Building C object CMakeFiles\cmTC_c3ca9.dir\getarch.c.obj In file included from C:/home/Algebra_libs/OpenBLAS-develop/cpuid_x86.c(284,7): warning: unused
C:/home/Algebra_libs/OpenBLAS-develop/cpuid_x86.c(284,21): warning: unused
C:/home/Algebra_libs/OpenBLAS-develop/cpuid_x86.c(283,7): warning: unused
C:/home/Algebra_libs/OpenBLAS-develop/cpuid_x86.c(285,7): warning: unused
C:/home/Algebra_libs/OpenBLAS-develop/cpuid_x86.c(283,22): warning: unused
C:/home/Algebra_libs/OpenBLAS-develop/cpuid_x86.c(285,13): warning: unused
C:/home/Algebra_libs/OpenBLAS-develop/cpuid_x86.c(2057,4): warning: add
C:/home/Algebra_libs/OpenBLAS-develop/cpuid_x86.c(2074,4): warning: add
8 warnings generated. FAILED: cmTC_c3ca9.exe cmd.exe /C "cd . && C:\Users\Admin\anaconda3\Library\bin\cmake.exe -E CMakeFiles\cmTC_c3ca9.dir\cpuid.S.obj : fatal error LNK1112: module machine ninja: build stopped: subcommand failed. Call Stack (most recent call first): -- Configuring incomplete, errors occurred! In the error logs the following Checking whether the ASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)": |
@isuruf seems the problem is with linking the |
If this build is broken recently, then maybe reasonable to try with an older version instead of using the latest one? |
@realgarik, can you try downloading |
Let me download it, if I understand it correctly, I need to build clang for windows... |
Here's a pre-built binary, https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win32.exe |
@martin-frbg, do you know if |
@isuruf it is not explicitly passed at least - |
Sorry, I meant |
Hmm. I see CMAKE_C_FLAGS_DEBUG conditionally appended to GETARCH_FLAGS in system.cmake, but no explicit passing or adding of CMAKE_C_FLAGS in either file. |
@isuruf today I've built the clang for Win32 arch. Did the same variable initialization that you provided before for CC and CXX variables to set to my newly built clang-cl.exe and here is the result for cmake build: FAILED: cmTC_5ce47.exe cmd.exe /C "cd . && C:\Users\Admin\anaconda3\Library\bin\cmake.exe -E LINK: command CMakeFiles\cmTC_5ce47.dir\cpuid.S.obj : fatal error LNK1112: module machine |
@realgarik, can you send the full output after a clean build? I suspect that the correct clang-cl was not picked up. |
@isuruf , Actually by correctly setting CC, CXX flags to refer to my newly built clang-cl.exe set CC="C:/home/llvm-project-master/build/Release/bin/clang-cl.exe" and providing the same .exe to cmake command line: cmake .. -G "Ninja" -DCMAKE_CXX_COMPILER="C:/home/llvm-project-master/build/Release/bin/clang-cl.exe" -DCMAKE_C_COMPILER="C:/home/llvm-project-master/build/Release/bin/clang-cl.exe" -DBUILD_WITHOUT_LAPACK=yes -DNOFORTRAN=1 -DDYNAMIC_ARCH=ON I was able to complete build, but now I am receiving the linker errors: Below is the log for Target=generic FAILED: utest/openblas_utest.exe and here is the log for DYNAMIC_ARCH enabled: [9373/9373] Linking C executable utest\openblas_utest.exe The list is long for dynamic arch, so I will mention just module names which are failing: |
@isuruf , @martin-frbg , do you have any clue for these link issues? |
Sorry; I have no idea what is happening here. I trust you started from a clean build directory every time you changed cmake options (?) Perhaps a complete build log would help (and perhaps you could add CMAKE_VERBOSE_MAKEFILE=ON to your |
Maybe unrelated, but MSVC does not support VLA and AT&T assembly which are required by |
Yes, this was clarified in #2826 (comment) , then TARGET=generic was used instead with MSVC and the discussion moved on to building with LLVM (clang-cl) for better performance - which worked for x64 but failed for 32bit. (Maybe the "wrong" linker got called, or 64bit object files got picked up from an earlier build attempt, but at that point it seems everybody ran out of time or energy) |
Sorry guys I didn't have time to dig into the issue so finally it was decided to drop the x86. |
Hi,
I'm trying to build openBLAS for Windows x86 platform as it is described in build page:
CMake and Visual Studio
To build OpenBLAS for the 32-bit architecture, you'll need to use the builtin Visual Studio compilers.
Here is the cmake command that I'm running on my "Haswell" host machine. Afterwards build with VS17 completes successfully:
cmake -G "Visual Studio 15 2017" -A Win32 -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DCMAKE_BUILD_TYPE=Release
but once I'm adding the DYNAMIC_ARCH feature enabling like this:
cmake -G "Visual Studio 15 2017" -A Win32 -DBUILD_WITHOUT_LAPACK=no -DNOFORTRAN=0 -DDYNAMIC_ARCH=ON -DCMAKE_BUILD_TYPE=Release
the build fails with some errors without generating the output library.
Note: that the same feature set mentioned above is working for x64 architecture using "1. Native (MSVC) ABI" build option.
Is it a known issue, or am I missed something?
The text was updated successfully, but these errors were encountered: