Shouldn't the testing/Makefile use the ${LIBDIR} value set in make.inc? It appears it doesn't, or I've missed something!
[mkbane@gpu magma_1.0.0-rc5]$ cat make.inc
#//////////////////////////////////////////////////////////////////////////////
# -- MAGMA (version 1.0) --
# Univ. of Tennessee, Knoxville
# Univ. of California, Berkeley
# Univ. of Colorado, Denver
# November 2010
#
# Contributed by: MICHAEL K BANE
#//////////////////////////////////////////////////////////////////////////////
#
# GPU_TARGET specifies for which GPU you want to compile MAGMA
# 0: Tesla family
# 1: Fermi Family
#
GPU_TARGET = 1
CC = gcc
NVCC = nvcc
### MKB: load PGI module
FORT = pgf90
ARCH = ar
ARCHFLAGS = cr
RANLIB = ranlib
OPTS = -O3 -DADD_
### -Mcpp for pgf90 pre-processing
FOPTS = -O3 -DADD_ -Mpreprocess
NVOPTS = -DADD_ --compiler-options -fno-strict-aliasing -DUNIX -O3
LDOPTS = -fPIC
LIB =
### load CUDA module
CUDADIR = /export/cuda/cuda3.2.16
LIBDIR = -L ${CUDADIR}/lib
INC = -I../include -I$(CUDADIR)/include
LIBMAGMA = ../lib/libmagma.a
LIBMAGMABLAS = ../lib/libmagmablas.a
then for make all is fine I believe until
make[1]: Entering directory `/home/ge199/ge199/mkbane/magma_1.0.0-rc5/testing'
gcc -O3 -DADD_ -DGPUSHMEM=200 -I../include -I/export/cuda/cuda3.2.16/include -I../include -I../quark/include -c testing_zgemm.cpp -o testing_zgemm.o
gcc -O3 -DADD_ -DGPUSHMEM=200 -fPIC -DGPUSHMEM=200 testing_zgemm.o -o testing_zgemm lin/liblapacktest.a -L../lib \
-lcuda -lmagma -lmagmablas -lmagma -L /export/cuda/cuda3.2.16/lib
testing_zgemm.o: In function `main':
testing_zgemm.cpp:(.text+0x5c): undefined reference to `cublasInit'
testing_zgemm.cpp:(.text+0x32e): undefined reference to `cudaMalloc'
testing_zgemm.cpp:(.text+0x367): undefined reference to `cudaMalloc'
testing_zgemm.cpp:(.text+0x390): undefined reference to `cudaMalloc'
testing_zgemm.cpp:(.text+0x510): undefined reference to `zlarnv_'
testing_zgemm.cpp:(.text+0x532): undefined reference to `zlarnv_'
testing_zgemm.cpp:(.text+0x554): undefined reference to `zlarnv_'
testing_zgemm.cpp:(.text+0x580): undefined reference to `cublasSetMatrix'
testing_zgemm.cpp:(.text+0x5ac): undefined reference to `cublasSetMatrix'
testing_zgemm.cpp:(.text+0x5dc): undefined reference to `cublasSetMatrix'
testing_zgemm.cpp:(.text+0x655): undefined reference to `cublasZgemm'
testing_zgemm.cpp:(.text+0x69d): undefined reference to `cublasGetMatrix'
testing_zgemm.cpp:(.text+0x6cd): undefined reference to `cublasSetMatrix'
testing_zgemm.cpp:(.text+0x746): undefined reference to `cublasZgemm'
testing_zgemm.cpp:(.text+0x78e): undefined reference to `cublasGetMatrix'
testing_zgemm.cpp:(.text+0x7b8): undefined reference to `zaxpy_'
testing_zgemm.cpp:(.text+0x7e7): undefined reference to `zlange_'
testing_zgemm.cpp:(.text+0x9b5): undefined reference to `cudaFree'
testing_zgemm.cpp:(.text+0x9c2): undefined reference to `cudaFree'
testing_zgemm.cpp:(.text+0x9cf): undefined reference to `cudaFree'
testing_zgemm.cpp:(.text+0x9e1): undefined reference to `cublasShutdown'
testing_zgemm.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
../lib/libmagma.a(auxiliary.o): In function `getv':
auxiliary.cpp:(.text+0xa40): undefined reference to `cublasGetVector'
../lib/libmagma.a(auxiliary.o): In function `swp2pswp':
auxiliary.cpp:(.text+0xa73): undefined reference to `lsame_'
../lib/libmagma.a(auxiliary.o): In function `get_current_time':
auxiliary.cpp:(.text+0xce5): undefined reference to `cudaThreadSynchronize'
../lib/libmagma.a(auxiliary.o): In function `magma_gettime_f_':
auxiliary.cpp:(.text+0xd45): undefined reference to `cudaThreadSynchronize'
../lib/libmagma.a(auxiliary.o):(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
make[1]: *** [testing_zgemm] Error 1
rm testing_zgemm.o
make[1]: Leaving directory `/home/ge199/ge199/mkbane/magma_1.0.0-rc5/testing'
make: *** [test] Error 2
[mkbane@gpu magma_1.0.0-rc5]$
Makefile for testing
-
Stan Tomov
- Posts: 283
- Joined: Fri Aug 21, 2009 10:39 pm
Re: Makefile for testing
There could be several reasons for these errors. The first error is because there is no linking to cublas. In make.inc you have to initialize the LIB variable. See the example make.inc.* files. For example on my system I link to MKL and have
Independent of what LAPACK you use, you always have to have -lcublas.
Also sometimes people report errors if they have several CUDA versions installed on their systems. If you type
do you see a link to /export/cuda/cuda3.2.16 or to some other CUDA version?
The undefined reference to `__gxx_personality_v0' is something from the C++ compiler. Try to add something like -lstdc++ in the linking stage to see if it would work (e.g., you can add it to the LIB variable in make.inc).
Stan
Code: Select all
LIB = -lmkl_em64t -lguide -lpthread -lcublas -lcudart -lm
Independent of what LAPACK you use, you always have to have -lcublas.
Also sometimes people report errors if they have several CUDA versions installed on their systems. If you type
Code: Select all
echo $LD_LIBRARY_PATH
The undefined reference to `__gxx_personality_v0' is something from the C++ compiler. Try to add something like -lstdc++ in the linking stage to see if it would work (e.g., you can add it to the LIB variable in make.inc).
Stan