OpenMathLib / OpenBLAS

OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
http://www.openblas.net
BSD 3-Clause "New" or "Revised" License
6.43k stars 1.51k forks source link

OpenBLAS installation errors #1853

Closed JacobsJohan closed 6 years ago

JacobsJohan commented 6 years ago

I am trying to install OpenBLAS on my virtual machine (Ubuntu 16.04), but I run into trouble during the 'make' process. The CPU of my device is an Intel i7-6700HQ.

To get a more detailed error log, I ran $ make VERBOSE=1 but it doesn't seem to give much more useful information. I looked at my gcc and gfortran versions as suggested in a similar issue and they are both the same. I have tried to add TARGET=SKYLAKEX since that's the architecture I'm using, however this didn't solve the issue.

Does anyone have an idea of what the problem might be?

Here is the output from where it goes wrong:

[ 98%] Building Fortran object test/CMakeFiles/zblat3.dir/zblat3.f.o cd /home/johan/OpenBLAS/build/test && /usr/bin/gfortran -I/home/johan/OpenBLAS/lapack-netlib/LAPACKE/include -I/home/johan/OpenBLAS -I/home/johan/OpenBLAS/build -Wall -m32 -fPIC -c /home/johan/OpenBLAS/test/zblat3.f -o CMakeFiles/zblat3.dir/zblat3.f.o /home/johan/OpenBLAS/test/zblat3.f:3154:15:

      ERR = ZERO
           1

Warning: Possible change of value in conversion from COMPLEX(8) to REAL(8) at (1) [-Wconversion] /home/johan/OpenBLAS/test/zblat3.f:3279:5:

60 CONTINUE
 1

Warning: Label 60 at (1) defined but not used /home/johan/OpenBLAS/test/zblat3.f:1244:36:

  $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )
                                1

Warning: Unused dummy argument ‘b’ at (1) [-Wunused-dummy-argument] /home/johan/OpenBLAS/test/zblat3.f:1244:40:

  $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )
                                    1

Warning: Unused dummy argument ‘bb’ at (1) [-Wunused-dummy-argument] /home/johan/OpenBLAS/test/zblat3.f:1244:44:

  $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )
                                        1

Warning: Unused dummy argument ‘bs’ at (1) [-Wunused-dummy-argument]

[ 99%] Linking Fortran executable zblat3 cd /home/johan/OpenBLAS/build/test && /usr/bin/cmake -E cmake_link_script CMakeFiles/zblat3.dir/link.txt --verbose=1 /usr/bin/gfortran -Wall -m32 -fPIC CMakeFiles/zblat3.dir/zblat3.f.o -o zblat3 ../lib/libopenblas.a -lpthread ../lib/libopenblas.a(ztrmm_LNLN.c.o): In function ztrmm_LNLN': ztrmm_LNLN.c:(.text+0x281): undefined reference toztrmm_kernel_LT' ztrmm_LNLN.c:(.text+0x33d): undefined reference to ztrmm_kernel_LT' ztrmm_LNLN.c:(.text+0x48a): undefined reference toztrmm_kernel_LT' ztrmm_LNLN.c:(.text+0x546): undefined reference to ztrmm_kernel_LT' ../lib/libopenblas.a(ztrmm_LNUN.c.o): In functionztrmm_LNUN': ztrmm_LNUN.c:(.text+0x261): undefined reference to ztrmm_kernel_LN' ztrmm_LNUN.c:(.text+0x303): undefined reference toztrmm_kernel_LN' ztrmm_LNUN.c:(.text+0x59e): undefined reference to ztrmm_kernel_LN' ../lib/libopenblas.a(ztrmm_LNLU.c.o): In functionztrmm_LNLU': ztrmm_LNLU.c:(.text+0x281): undefined reference to ztrmm_kernel_LT' ztrmm_LNLU.c:(.text+0x33d): undefined reference toztrmm_kernel_LT' ztrmm_LNLU.c:(.text+0x48a): undefined reference to ztrmm_kernel_LT' ztrmm_LNLU.c:(.text+0x546): undefined reference toztrmm_kernel_LT' ../lib/libopenblas.a(ztrmm_LNUU.c.o): In function ztrmm_LNUU': ztrmm_LNUU.c:(.text+0x261): undefined reference toztrmm_kernel_LN' ztrmm_LNUU.c:(.text+0x303): undefined reference to ztrmm_kernel_LN' ztrmm_LNUU.c:(.text+0x59e): undefined reference toztrmm_kernel_LN' ../lib/libopenblas.a(ztrmm_LTLN.c.o): In function ztrmm_LTLN': ztrmm_LTLN.c:(.text+0x261): undefined reference toztrmm_kernel_LN' ztrmm_LTLN.c:(.text+0x303): undefined reference to ztrmm_kernel_LN' ../lib/libopenblas.a(ztrmm_LTLN.c.o):ztrmm_LTLN.c:(.text+0x59a): more undefined references toztrmm_kernel_LN' follow ../lib/libopenblas.a(ztrmm_LTUN.c.o): In function ztrmm_LTUN': ztrmm_LTUN.c:(.text+0x281): undefined reference toztrmm_kernel_LT' ztrmm_LTUN.c:(.text+0x33d): undefined reference to ztrmm_kernel_LT' ztrmm_LTUN.c:(.text+0x48a): undefined reference toztrmm_kernel_LT' ztrmm_LTUN.c:(.text+0x546): undefined reference to ztrmm_kernel_LT' ../lib/libopenblas.a(ztrmm_LTLU.c.o): In functionztrmm_LTLU': ztrmm_LTLU.c:(.text+0x261): undefined reference to ztrmm_kernel_LN' ztrmm_LTLU.c:(.text+0x303): undefined reference toztrmm_kernel_LN' ztrmm_LTLU.c:(.text+0x59a): undefined reference to ztrmm_kernel_LN' ../lib/libopenblas.a(ztrmm_LTUU.c.o): In functionztrmm_LTUU': ztrmm_LTUU.c:(.text+0x281): undefined reference to ztrmm_kernel_LT' ztrmm_LTUU.c:(.text+0x33d): undefined reference toztrmm_kernel_LT' ztrmm_LTUU.c:(.text+0x48a): undefined reference to ztrmm_kernel_LT' ztrmm_LTUU.c:(.text+0x546): undefined reference toztrmm_kernel_LT' ../lib/libopenblas.a(ztrmm_RNLN.c.o): In function ztrmm_RNLN': ztrmm_RNLN.c:(.text+0x370): undefined reference toztrmm_kernel_RT' ztrmm_RNLN.c:(.text+0x47b): undefined reference to ztrmm_kernel_RT' ../lib/libopenblas.a(ztrmm_RNUN.c.o): In functionztrmm_RNUN': ztrmm_RNUN.c:(.text+0x290): undefined reference to ztrmm_kernel_RN' ztrmm_RNUN.c:(.text+0x439): undefined reference toztrmm_kernel_RN' ../lib/libopenblas.a(ztrmm_RNLU.c.o): In function ztrmm_RNLU': ztrmm_RNLU.c:(.text+0x370): undefined reference toztrmm_kernel_RT' ztrmm_RNLU.c:(.text+0x47b): undefined reference to ztrmm_kernel_RT' ../lib/libopenblas.a(ztrmm_RNUU.c.o): In functionztrmm_RNUU': ztrmm_RNUU.c:(.text+0x290): undefined reference to ztrmm_kernel_RN' ztrmm_RNUU.c:(.text+0x439): undefined reference toztrmm_kernel_RN' ../lib/libopenblas.a(ztrmm_RTLN.c.o): In function ztrmm_RTLN': ztrmm_RTLN.c:(.text+0x290): undefined reference toztrmm_kernel_RN' ztrmm_RTLN.c:(.text+0x437): undefined reference to ztrmm_kernel_RN' ../lib/libopenblas.a(ztrmm_RTUN.c.o): In functionztrmm_RTUN': ztrmm_RTUN.c:(.text+0x36e): undefined reference to ztrmm_kernel_RT' ztrmm_RTUN.c:(.text+0x479): undefined reference toztrmm_kernel_RT' ../lib/libopenblas.a(ztrmm_RTLU.c.o): In function ztrmm_RTLU': ztrmm_RTLU.c:(.text+0x290): undefined reference toztrmm_kernel_RN' ztrmm_RTLU.c:(.text+0x437): undefined reference to ztrmm_kernel_RN' ../lib/libopenblas.a(ztrmm_RTUU.c.o): In functionztrmm_RTUU': ztrmm_RTUU.c:(.text+0x36e): undefined reference to ztrmm_kernel_RT' ztrmm_RTUU.c:(.text+0x479): undefined reference toztrmm_kernel_RT' ../lib/libopenblas.a(ztrmm_LRLN.c.o): In function ztrmm_LRLN': ztrmm_LRLN.c:(.text+0x281): undefined reference toztrmm_kernel_LC' ztrmm_LRLN.c:(.text+0x33d): undefined reference to ztrmm_kernel_LC' ztrmm_LRLN.c:(.text+0x48a): undefined reference toztrmm_kernel_LC' ztrmm_LRLN.c:(.text+0x546): undefined reference to ztrmm_kernel_LC' ../lib/libopenblas.a(ztrmm_LRUN.c.o): In functionztrmm_LRUN': ztrmm_LRUN.c:(.text+0x261): undefined reference to ztrmm_kernel_LR' ztrmm_LRUN.c:(.text+0x303): undefined reference toztrmm_kernel_LR' ztrmm_LRUN.c:(.text+0x59e): undefined reference to ztrmm_kernel_LR' ../lib/libopenblas.a(ztrmm_LRLU.c.o): In functionztrmm_LRLU': ztrmm_LRLU.c:(.text+0x281): undefined reference to ztrmm_kernel_LC' ztrmm_LRLU.c:(.text+0x33d): undefined reference toztrmm_kernel_LC' ztrmm_LRLU.c:(.text+0x48a): undefined reference to ztrmm_kernel_LC' ztrmm_LRLU.c:(.text+0x546): undefined reference toztrmm_kernel_LC' ../lib/libopenblas.a(ztrmm_LRUU.c.o): In function ztrmm_LRUU': ztrmm_LRUU.c:(.text+0x261): undefined reference toztrmm_kernel_LR' ztrmm_LRUU.c:(.text+0x303): undefined reference to ztrmm_kernel_LR' ztrmm_LRUU.c:(.text+0x59e): undefined reference toztrmm_kernel_LR' ../lib/libopenblas.a(ztrmm_LCLN.c.o): In function ztrmm_LCLN': ztrmm_LCLN.c:(.text+0x261): undefined reference toztrmm_kernel_LR' ztrmm_LCLN.c:(.text+0x303): undefined reference to ztrmm_kernel_LR' ../lib/libopenblas.a(ztrmm_LCLN.c.o):ztrmm_LCLN.c:(.text+0x59a): more undefined references toztrmm_kernel_LR' follow ../lib/libopenblas.a(ztrmm_LCUN.c.o): In function ztrmm_LCUN': ztrmm_LCUN.c:(.text+0x281): undefined reference toztrmm_kernel_LC' ztrmm_LCUN.c:(.text+0x33d): undefined reference to ztrmm_kernel_LC' ztrmm_LCUN.c:(.text+0x48a): undefined reference toztrmm_kernel_LC' ztrmm_LCUN.c:(.text+0x546): undefined reference to ztrmm_kernel_LC' ../lib/libopenblas.a(ztrmm_LCLU.c.o): In functionztrmm_LCLU': ztrmm_LCLU.c:(.text+0x261): undefined reference to ztrmm_kernel_LR' ztrmm_LCLU.c:(.text+0x303): undefined reference toztrmm_kernel_LR' ztrmm_LCLU.c:(.text+0x59a): undefined reference to ztrmm_kernel_LR' ../lib/libopenblas.a(ztrmm_LCUU.c.o): In functionztrmm_LCUU': ztrmm_LCUU.c:(.text+0x281): undefined reference to ztrmm_kernel_LC' ztrmm_LCUU.c:(.text+0x33d): undefined reference toztrmm_kernel_LC' ztrmm_LCUU.c:(.text+0x48a): undefined reference to ztrmm_kernel_LC' ztrmm_LCUU.c:(.text+0x546): undefined reference toztrmm_kernel_LC' ../lib/libopenblas.a(ztrmm_RRLN.c.o): In function ztrmm_RRLN': ztrmm_RRLN.c:(.text+0x370): undefined reference toztrmm_kernel_RC' ztrmm_RRLN.c:(.text+0x47b): undefined reference to ztrmm_kernel_RC' ../lib/libopenblas.a(ztrmm_RRUN.c.o): In functionztrmm_RRUN': ztrmm_RRUN.c:(.text+0x290): undefined reference to ztrmm_kernel_RR' ztrmm_RRUN.c:(.text+0x439): undefined reference toztrmm_kernel_RR' ../lib/libopenblas.a(ztrmm_RRLU.c.o): In function ztrmm_RRLU': ztrmm_RRLU.c:(.text+0x370): undefined reference toztrmm_kernel_RC' ztrmm_RRLU.c:(.text+0x47b): undefined reference to ztrmm_kernel_RC' ../lib/libopenblas.a(ztrmm_RRUU.c.o): In functionztrmm_RRUU': ztrmm_RRUU.c:(.text+0x290): undefined reference to ztrmm_kernel_RR' ztrmm_RRUU.c:(.text+0x439): undefined reference toztrmm_kernel_RR' ../lib/libopenblas.a(ztrmm_RCLN.c.o): In function ztrmm_RCLN': ztrmm_RCLN.c:(.text+0x290): undefined reference toztrmm_kernel_RR' ztrmm_RCLN.c:(.text+0x437): undefined reference to ztrmm_kernel_RR' ../lib/libopenblas.a(ztrmm_RCUN.c.o): In functionztrmm_RCUN': ztrmm_RCUN.c:(.text+0x36e): undefined reference to ztrmm_kernel_RC' ztrmm_RCUN.c:(.text+0x479): undefined reference toztrmm_kernel_RC' ../lib/libopenblas.a(ztrmm_RCLU.c.o): In function ztrmm_RCLU': ztrmm_RCLU.c:(.text+0x290): undefined reference toztrmm_kernel_RR' ztrmm_RCLU.c:(.text+0x437): undefined reference to ztrmm_kernel_RR' ../lib/libopenblas.a(ztrmm_RCUU.c.o): In functionztrmm_RCUU': ztrmm_RCUU.c:(.text+0x36e): undefined reference to ztrmm_kernel_RC' ztrmm_RCUU.c:(.text+0x479): undefined reference toztrmm_kernel_RC' collect2: error: ld returned 1 exit status test/CMakeFiles/zblat3.dir/build.make:95: recipe for target 'test/zblat3' failed make[2]: [test/zblat3] Error 1 make[2]: Leaving directory '/home/johan/OpenBLAS/build' CMakeFiles/Makefile2:568: recipe for target 'test/CMakeFiles/zblat3.dir/all' failed make[1]: [test/CMakeFiles/zblat3.dir/all] Error 2 make[1]: Leaving directory '/home/johan/OpenBLAS/build' Makefile:138: recipe for target 'all' failed make: *** [all] Error 2 johan@johan-VirtualBox:~/OpenBLAS/build$

martin-frbg commented 6 years ago

First of all which version of OpenBLAS are you trying to build ? Then, i7-6700HQ is almost certainly not Skylake X (high-end workstation cpu with AVX512 support) but plain Skylake, which is covered by TARGET=HASWELL in OpenBLAS. "Undefined reference to" one of the gemm or trmm microkernels is usually caused by cpu misdetection - there should be another error much earlier in the log where it fails to build, or even to find, the appropriate source file in kernel/x86_64. (Another oddity is that your log mentions the -m32 compiler option - are you really trying to build in and for a 32bit operating system environment ?)

JacobsJohan commented 6 years ago

I'm trying to build the latest version of OpenBLAS (I did a git clone https://github.com/xianyi/OpenBLAS). I guess I got confused with the architecture. I just looked up my CPU on Wikipedia and found it under Skylake and assumed it was SKYLAKEX. I will change the target to HASWELL and see if that solves it.

I also would prefer to build it for a 64 bit operating system, since that's what I'm using. I guess the default option is 32 bit and I can change this somewhere?

brada4 commented 6 years ago

first check /proc/cpuinfo if virtualisation preserves avx2 flag Then proceed to FAQ entry: https://github.com/xianyi/OpenBLAS/wiki/faq#debianlts Tell if it does not work....

-m32 by default may mean you are running a 32bit system and none of AVX can work in a 32bit system. Also your pasted output contains mentions of CMAKE, so make a fresh git clone, because cmake replaces Makefile-s used by make.

JacobsJohan commented 6 years ago

The cpuinfo does list the avx2 flag: Architecture: i686 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 94 Model name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz Stepping: 3 CPU MHz: 2591.998 BogoMIPS: 5183.99 Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 6144K Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc xtopology nonstop_tsc cpuid pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase avx2 invpcid rdseed clflushopt

However using TARGET=HASWELL still gave the same error.

martin-frbg commented 6 years ago

Can you upload the full build log please ? (I assume you started from a clean build directory again)

JacobsJohan commented 6 years ago

Another note: I have managed to use BLAS and LAPACK on this VM by using the CBLAS wrapper because I need to implement the vector operations in C++ code. But because the documentation for CBLAS was quite confusing to me, I decided to work with Armadillo instead, which requires OpenBLAS first.

I'm currently running 'make DYNAMIC_ARCH=1' as listed in the link you provided. I will upload a full log when it completes.

JacobsJohan commented 6 years ago

make.txt Attached is the build log file from building with TARGET=HASWELL. Prior to running the make, I deleted my OpenBlas clone and got a fresh one from github.

brada4 commented 6 years ago

It is a cmake build without parameters you passed to cmake or to make.... ztrm_kernel_LN was not built at all, probably it is 5th build in same directory or so.

CBLAS " wrapper" is integrated in OpenBLAS unless you disable it with too many parameters. You can also use cblas.h from libblas-dev ubuntu package.

EDIT: your cpuid looks good (is it /proc/cpuinfo ?) , but system architecture looks suspicious.

Architecture: i686

JacobsJohan commented 6 years ago

I was not aware I had to pass parameters to cmake or make (except for the target architecture for make).

martin-frbg commented 6 years ago

With cmake, you will probably need to specify the target with -D as in cmake -DTARGET=HASWELL, not sure if you did this ? Unfortunately it is not apparent from the log which options are active, but most of this information should be in the generated config.h

brada4 commented 6 years ago

@JacobsJohan bad news: you are running 32bit virtual guest machine. Highest architecture you can get TARGET=NEHALEM, like half speed of real 64bit haswell guest. lscpu shows Architecture: x86_64 on a 64bit linux.

JacobsJohan commented 6 years ago

Ah yes you are correct it is a 32bit image I'm using. I managed to build it with TARGET=NEHALEM as well. In that case, thank you both very much for your help! I will consider getting a 64 bit guest machine in case I need more performance. But for the moment this solves my issue!

brada4 commented 6 years ago

Does it build without TARGET= specified on present 32bit image?

JacobsJohan commented 6 years ago

No it didn't work without the TARGET set to NEHALEM. Maybe the system got confused because it expected a different target.

brada4 commented 6 years ago

Did it detect CPU as something i.e. typing make clean ; make

JacobsJohan commented 6 years ago

When I run cmake .. in the build folder it shows: -- GETARCH results: CORE=HASWELL LIBCORE=haswell NUM_CORES=4 HAVE_MMX=1 HAVE_SSE=1 HAVE_SSE2=1 HAVE_SSE3=1 HAVE_SSSE3=1 HAVE_SSE4_1=1 HAVE_SSE4_2=1 HAVE_AVX=1 MAKE += -j 4

Running make clean; make doesn't show any specific CPU information as far as I can see, however it does start building everything.

brada4 commented 6 years ago

It is detected fine.