error in linking

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
Posts: 2
Joined: Tue Oct 13, 2009 9:23 am

error in linking

Post by welcome2010 » Tue Oct 13, 2009 9:37 am


I've just downloaded Magma, modified with path to Intel MKL, and ran make. I'm getting the following error while linking. Could you please let me know if I'm missing anything? Thanks.

( cd testing; make )
make[1]: Entering directory `/home/st/sbyna/necla/cuda_trials/benchmarks/magma_0.1/testing'
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_spotrf.cpp -o testing_spotrf.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_spotrf_gpu.cpp -o testing_spotrf_gpu.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_sgeqrf.cpp -o testing_sgeqrf.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_sgeqrf_gpu.cpp -o testing_sgeqrf_gpu.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_sgetrf.cpp -o testing_sgetrf.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_sgetrf_gpu.cpp -o testing_sgetrf_gpu.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_dpotrf.cpp -o testing_dpotrf.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_dpotrf_gpu.cpp -o testing_dpotrf_gpu.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_dgeqrf.cpp -o testing_dgeqrf.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_dgeqrf_gpu.cpp -o testing_dgeqrf_gpu.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_dgetrf.cpp -o testing_dgetrf.o
gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_dgetrf_gpu.cpp -o testing_dgetrf_gpu.o
gcc -fPIC testing_spotrf.o -o testing_spotrf -L../lib \
-lcuda -lmagma -lmagmablas -L/opt/intel/mkl721/lib/em64t -L/usr/local/cuda/lib -lmkl_em64t -lguide -lpthread -lcublas -lm get_nb.cpp
testing_spotrf.o: In function `main':
testing_spotrf.cpp:(.text+0x31e): undefined reference to `spotrf_'
testing_spotrf.cpp:(.text+0x383): undefined reference to `slange_'
testing_spotrf.cpp:(.text+0x3cb): undefined reference to `slange_'
../lib/libmagma.a(spotrf.o): In function `magma_spotrf(char*, int*, float*, int*, float*, int*)':
spotrf.cpp:(.text+0x154): undefined reference to `spotrf_'
spotrf.cpp:(.text+0x3ce): undefined reference to `spotrf_'
spotrf.cpp:(.text+0x429): undefined reference to `spotrf_'
../lib/libmagma.a(auxiliary.o): In function `dqrt02(int*, int*, int*, double*, double*, double*, double*, int*, double*, double*, int*, double*, double*)':
auxiliary.cpp:(.text+0x450): undefined reference to `dlamch_'
auxiliary.cpp:(.text+0x481): undefined reference to `dlaset_'
auxiliary.cpp:(.text+0x4b5): undefined reference to `dlacpy_'
auxiliary.cpp:(.text+0x4f7): undefined reference to `dorgqr_'
auxiliary.cpp:(.text+0x521): undefined reference to `dlaset_'
auxiliary.cpp:(.text+0x546): undefined reference to `dlacpy_'
auxiliary.cpp:(.text+0x5b6): undefined reference to `dlange_'
auxiliary.cpp:(.text+0x5eb): undefined reference to `dlange_'
auxiliary.cpp:(.text+0x66e): undefined reference to `dlaset_'
auxiliary.cpp:(.text+0x6c5): undefined reference to `dlansy_'
../lib/libmagma.a(auxiliary.o): In function `sqrt02(int*, int*, int*, float*, float*, float*, float*, int*, float*, float*, int*, float*, float*)':
auxiliary.cpp:(.text+0x780): undefined reference to `slamch_'
auxiliary.cpp:(.text+0x7b1): undefined reference to `slaset_'
auxiliary.cpp:(.text+0x7e5): undefined reference to `slacpy_'
auxiliary.cpp:(.text+0x827): undefined reference to `sorgqr_'
auxiliary.cpp:(.text+0x851): undefined reference to `slaset_'
auxiliary.cpp:(.text+0x876): undefined reference to `slacpy_'
auxiliary.cpp:(.text+0x8e6): undefined reference to `slange_'
auxiliary.cpp:(.text+0x91f): undefined reference to `slange_'
auxiliary.cpp:(.text+0x9b3): undefined reference to `slaset_'
auxiliary.cpp:(.text+0xa0a): undefined reference to `slansy_'
collect2: ld returned 1 exit status
make[1]: *** [testing_spotrf] Error 1
make[1]: Leaving directory `/home/st/sbyna/necla/cuda_trials/benchmarks/magma_0.1/testing'
make: *** [test] Error 2

Stan Tomov
Posts: 263
Joined: Fri Aug 21, 2009 10:39 pm

Re: error in linking

Post by Stan Tomov » Tue Oct 13, 2009 1:57 pm

The undefined functions are in the LAPACK library and should be recognized (in general) in the MKL library when you link with
"-L/opt/intel/mkl721/lib/em64t -lmkl_em64t -lguide"
What version of gcc and mkl are you using? We use mkl and compile exactly in the way you are trying.
Would replacing "-lmkl_em64t -lguide" by "-lmkl_sequential -lmkl_intel_lp64 -lmkl_core" work?
If not what are you getting from
nm /opt/intel/mkl721/lib/em64t/libmkl_intel_lp64.a | grep 'spotrf_'

Something like this?
_spotrf_lp64.o: 0000000000000000 T spotrf_


Posts: 2
Joined: Tue Oct 13, 2009 9:23 am

Re: error in linking

Post by welcome2010 » Wed Oct 14, 2009 9:48 am

Hi Stan,

Thanks for your response. Replacing "-lmkl_em64t -lguide" with "-lmkl_lapack -lmkl_em64t -lguide" helped solving the problem. Older versions of MKL (7.2.1 in our case) probably have the LAPACK library separately.


Post Reply