Error compiling MAGMA 1.5.0 beta 2 in Debian Sid

Open discussion for MAGMA

Error compiling MAGMA 1.5.0 beta 2 in Debian Sid

Postby jgpallero » Sun Jun 29, 2014 7:29 am

Hello,

I have a Debian Sid (64 bits) installation with the GCC compilers 4.8 and 4.9 and CUDA 6.0. I'm trying to compile the MAGMA 1.5.0 beta 2 version and I obtain an error during make test.

First of all, as GCC 4.9 is not permitted in CUDA 6.0, I set the related variables in the make.inc file as
Code: Select all
CC        = gcc-4.8
NVCC      = nvcc --compiler-bindir /usr/bin/gcc-4.8
FORT      = gfortran-4.8


The make lib command works well, and libmagma.a is created in the lib/ folder. But in make test I obtain the error
Code: Select all
gcc-4.8 -fPIC -Xlinker -zmuldefs  testing_zhetrd_he2hb.o -o testing_zhetrd_he2hb \
libtest.a lin/liblapacktest.a -L../lib -lmagma \
-L/opt/openblas/lib -L/opt/cuda/lib64 -L/usr/lib64 \
-lopenblas  -lpthread -lcublas -lcudart -llapack -lm
/usr/bin/ld: ../lib/libmagma.a(zhetrd_hb2st.o): undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:255: recipe for target 'testing_zhetrd_he2hb' failed
make[1]: *** [testing_zhetrd_he2hb] Error 1
make[1]: Leaving directory '/home/topo/Desktop/magma-1.5.0-beta2/testing'
Makefile:54: recipe for target 'test' failed
make: *** [test] Error 2


Searching in the web I've seen that the error __gxx_personality_v0@@CXXABI_1.3 is produced because I'm trying to compile C++ code with a C compiler, so I change
Code: Select all
CC        = gcc-4.8

by
Code: Select all
CC        = g++-4.8

in the make.inc file. This apparently solves the error, but a new one appears
Code: Select all
g++-4.8 -O3 -DADD_ -DHAVE_CUBLAS -DMIN_CUDA_ARCH=300 -DCUBLAS_GFORTRAN -I/opt/cuda/include -I../include -I../control -c /opt/cuda/src/fortran.c -o fortran.o
gfortran-4.8 -O3 -DADD_ -x f95-cpp-input -Dmagma_devptr_t="integer(kind=8)" -I/opt/cuda/include -I../include -I../control -c testing_zgetrf_gpu_f.F90 -o testing_zgetrf_gpu_f.o
gfortran-4.8 -fPIC -Xlinker -zmuldefs testing_zgetrf_gpu_f.o fortran.o -o testing_zgetrf_gpu_f \
libtest.a lin/liblapacktest.a -L../lib -lmagma \
-L/opt/openblas/lib -L/opt/cuda/lib64 -L/usr/lib64 \
-lopenblas  -lpthread -lcublas -lcudart -llapack -lm
/usr/bin/ld: ../lib/libmagma.a(ztrevc3_mt.o): undefined reference to symbol '__cxa_pure_virtual@@CXXABI_1.3'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:249: recipe for target 'testing_zgetrf_gpu_f' failed
make[1]: *** [testing_zgetrf_gpu_f] Error 1
make[1]: Leaving directory '/home/topo/Desktop/magma-1.5.0-beta2/testing'
Makefile:54: recipe for target 'test' failed
make: *** [test] Error 2

If I put the CC = g++-4.8 from the beginning of the compilation, i. e., I execute make lib and make test with CC = g++-4.8, I obtain also the last error.

Anyway, as libmagma.a was created, I've installed the library. But when I try to compile a program, I obtain
Code: Select all
In file included from /opt/magma/include/magmablas_z.h:14:0,
                 from /opt/magma/include/magmablas.h:12,
                 from /opt/magma/include/magma.h:15,
                 from /home/topo/Desktop/libgeoc/libgeoc/geocblas.h:72,
                 from geocblas.c:59:
/opt/magma/include/magma_types.h:160:6: error: #error "One of HAVE_CUBLAS, HAVE_clAmdBlas, or HAVE_MIC must be defined. This typically happens in Makefile.internal."
     #error "One of HAVE_CUBLAS, HAVE_clAmdBlas, or HAVE_MIC must be defined. This typically happens in Makefile.internal."
      ^

But apparently HAVE_CUBLAS was defined in the Makefile.internal (lines 61-52) as
Code: Select all
NVOPTS += -DHAVE_CUBLAS $(NV_SM) $(NV_COMP)
OPTS   += -DHAVE_CUBLAS -DMIN_CUDA_ARCH=$(MIN_ARCH)


Has anyone had a similar error?

Thanks
jgpallero
 
Posts: 29
Joined: Tue Nov 15, 2011 12:38 pm

Re: Error compiling MAGMA 1.5.0 beta 2 in Debian Sid

Postby hsahasra » Mon Jun 30, 2014 2:25 pm

You need to define these preprocessor directives before you include magma.h, or while you compile your code:

#ifndef HAVE_CUBLAS
#define HAVE_CUBLAS
#endif

#ifndef ADD_
#define ADD_
#endif

#include "magma.h"

---or---

g++-4.8 -DHAVE_CUBLAS -DADD_

This is when you are using CUDA, and BLAS/LAPACK mangling adds an underscore.
hsahasra
 
Posts: 27
Joined: Mon Jun 24, 2013 3:40 pm

Re: Error compiling MAGMA 1.5.0 beta 2 in Debian Sid

Postby jgpallero » Mon Jun 30, 2014 2:28 pm

hsahasra wrote:You need to define these preprocessor directives before you include magma.h, or while you compile your code:

#ifndef HAVE_CUBLAS
#define HAVE_CUBLAS
#endif

#ifndef ADD_
#define ADD_
#endif

#include "magma.h"

---or---

g++-4.8 -DHAVE_CUBLAS -DADD_

This is when you are using CUDA, and BLAS/LAPACK mangling adds an underscore.


Mmmm, I don't know. In prior versions of MAGMA this was not neccessary
jgpallero
 
Posts: 29
Joined: Tue Nov 15, 2011 12:38 pm

Re: Error compiling MAGMA 1.5.0 beta 2 in Debian Sid

Postby mgates3 » Mon Jun 30, 2014 4:39 pm

Correct. For quite some time it has been required to define HAVE_CUBLAS when including magma.h. This is because very similar magma.h header files are used in CUDA MAGMA, OpenCL MAGMA, and Xeon Phi (MIC) MAGMA.

If you include magma_lapack.h, defining ADD_ has always been required. If you don't include the lapack functions, it shouldn't be required.

As for your compilation that fails, that particular case is using gfortran, so you probably need to add the C++ library to the link line, for instance -lstdc++.

Code: Select all
gfortran-4.8 -fPIC -Xlinker -zmuldefs testing_zgetrf_gpu_f.o fortran.o -o testing_zgetrf_gpu_f \
libtest.a lin/liblapacktest.a -L../lib -lmagma \
-L/opt/openblas/lib -L/opt/cuda/lib64 -L/usr/lib64 \
-lopenblas  -lpthread -lcublas -lcudart -llapack -lm \
-lstdc++


You can always just ignore the Fortran test cases (e.g., make -k) if you don't program in Fortran.

-mark
mgates3
 
Posts: 439
Joined: Fri Jan 06, 2012 2:13 pm

Re: Error compiling MAGMA 1.5.0 beta 2 in Debian Sid

Postby jgpallero » Mon Jun 30, 2014 5:22 pm

Thank you for your answer, Mark. And also thanks to hsahasra, who obviously was right and give a correct advice.
jgpallero
 
Posts: 29
Joined: Tue Nov 15, 2011 12:38 pm


Return to User discussion

Who is online

Users browsing this forum: Google [Bot] and 17 guests

cron