zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Open discussion for MAGMA

zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby lejeczek » Tue Apr 09, 2013 10:45 am

hi everybody

complier process encounters following errors:

rpmbuild/tars/magma-1.3.0-open64/src/zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'
../lib/libmagma.a(zlaqps.o): In function `magma_zlaqps':
rpmbuild/tars/magma-1.3.0-open64/src/zlaqps.cpp:138: undefined reference to `cblas_idamax'
rpmbuild/tars/magma-1.3.0-open64/src/zlaqps.cpp:343: undefined reference to `cblas_dznrm2'
rpmbuild/tars/magma-1.3.0-open64/src/zlaqps.cpp:338: undefined reference to `cblas_dznrm2'

what seems to be the problem can somebody suggest?
I should say I try with ACML + CUDA 5
many thanks
Pawel
lejeczek
 
Posts: 22
Joined: Tue Apr 09, 2013 2:57 am

Re: zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby mgates3 » Tue Apr 09, 2013 11:39 am

ACML doesn't include cblas. You can get it from:
http://www.netlib.org/blas/
-mark
mgates3
 
Posts: 387
Joined: Fri Jan 06, 2012 2:13 pm

Re: zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby lejeczek » Wed Apr 10, 2013 11:45 am

thanks! Mark
I thought lack of -lcblas in make.inc(as per plain-vanilla make.inc.acml) would make cblas redundant/unneeded
I got cblas now, have added -lcblas(it seemed like it would not compile without no matter what), seems like compilation get an extra mile but fails again this time:

rpmbuild/tars/magma-1.3.0-open64/src/dlaex1.cpp:202: undefined reference to `magma_dlaed2_'
lejeczek
 
Posts: 22
Joined: Tue Apr 09, 2013 2:57 am

Re: zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby mgates3 » Wed Apr 10, 2013 6:30 pm

Probably the make.inc.acml was just out-of-date. It needs -lcblas. MKL includes cblas, so it isn't needed there.

For the command that failed, please paste in the entire command and output. It's hard to tell exactly what you are compiling or linking here.

magma_dlaed2_ is a Fortran function defined in magma/src/dlaed2.f. Make sure that file was compiled correctly.

This also assumes that your Fortran compiler appends an underbar _ to function names. This is common, but not universal. Probably you can check using nm, though I'm not sure what the output would look like for different Fortran conventions. This is what it looks like for me, with appending an underbar:
magma-trunk/src> nm dlaed2.o
U _dcopy_
U _dlacpy_
U _dlamch_
U _dlamrg_
U _dlapy2_
U _drot_
U _dscal_
U _idamax_
00000000 T _magma_dlaed2_
U _xerbla_

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

Re: zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby lejeczek » Thu Apr 11, 2013 2:43 pm

with open64 nm src/dlaed2.o gives me:

U dcopy_
U dlacpy_
U dlamch_
U dlamrg_
U dlapy2_
U drot_
U dscal_
U idamax_
0000000000000000 T magma_dlaed2__
U xerbla

how can I fix it?
best regards
lejeczek
 
Posts: 22
Joined: Tue Apr 09, 2013 2:57 am

Re: zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby lejeczek » Thu Apr 11, 2013 2:45 pm

here is make.inc

GPU_TARGET = Fermi

CC = opencc
FORT = openf90
NVCC = nvcc

ARCH = ar
ARCHFLAGS = cr
RANLIB = ranlib

OPTS = -O3 -DADD_ -fPIC
F77OPTS = -O3 -DADD_
FOPTS = -O3 -DADD_
NVOPTS = -O3 -DADD_ --compiler-options -fno-strict-aliasing -DUNIX
LDOPTS = -fPIC -Xlinker

LIB = -lacml_mp -mp -lpthread -lm -lfortran -lffio -lmv -lcblas -lcublas

CUDADIR = /usr/local/cuda

LIBDIR = -L$(CUDADIR)/lib64 \
-L/opt/acml5.3.0/open64_64_mp_int64/lib \
-L/opt/lib64
INC = -I$(CUDADIR)/include \
-I/opt/acml5.3.0/open64_64_int64/include \
-I/opt/usr/include/libcblas
lejeczek
 
Posts: 22
Joined: Tue Apr 09, 2013 2:57 am

Re: zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby mgates3 » Thu Apr 11, 2013 3:28 pm

You can try, in dlaex1.cpp and dlaex1_m.cpp, changing:
#define magma_dlaed2 FORTRAN_NAME( magma_dlaed2, MAGMA_DLAED2 )
to:
#define magma_dlaed2 FORTRAN_NAME( magma_dlaed2_, MAGMA_DLAED2_ )

It seems to be adding two underscores to just that Fortran name, instead of one underscore.

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

Re: zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby lejeczek » Fri Apr 12, 2013 5:50 am

when I do edit the file you mentioned it gets me:

opencc -O3 -DADD_ -fPIC -DHAVE_CUBLAS -DGPUSHMEM=200 -I/usr/local/cuda/include -I/opt/acml-5-3-0-open64-64bit-int64/open64_64_int64/include -I/opt/usr/include/libcblas -I../include -I../control -c /usr/local/cuda/src/fortran.c -o fortran.o
In file included from /usr/local/cuda/src/fortran.c:67:
/usr/local/cuda/src/fortran_common.h:405:2: error: #error unsupported Fortran compiler
make[1]: *** [fortran.o] Error 1
lejeczek
 
Posts: 22
Joined: Tue Apr 09, 2013 2:57 am

Re: zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby mgates3 » Mon Apr 15, 2013 12:26 pm

That's a change in CUDA 5. It seems to require -DCUBLAS_GFORTRAN to compile the Fortran interface code. Add it to the OPTS in make.inc:

# CUDA 5 needs -DCUBLAS_GFORTRAN or appropriate setting to compile cuda/src/fortran.c bindings
OPTS = -O3 -DADD_ -DCUBLAS_GFORTRAN

This was in some but not all of the sample make.inc files.
-mark
mgates3
 
Posts: 387
Joined: Fri Jan 06, 2012 2:13 pm

Re: zgeqp3.cpp:220: undefined reference to `cblas_dznrm2'

Postby lejeczek » Wed Apr 17, 2013 4:44 am

for a novice like myself it really is frustrating, discouraging experience
no matter what I try it would not compile, not even with rhel-6.3-stock gcc/gfortran + atlas
atlas-3.8.4-2.el6.x86_64 + gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)

GPU_TARGET = Fermi

CC = gcc
NVCC = nvcc
FORT = gfortran

ARCH = ar
ARCHFLAGS = cr
RANLIB = ranlib

OPTS = -O3 -DADD_ -DCUBLAS_GFORTRAN
F77OPTS = -O3 -DADD_
FOPTS = -O3 -DADD_ -x f95-cpp-input
NVOPTS = -O3 -DADD_ --compiler-options -fno-strict-aliasing -DUNIX
LDOPTS = -fPIC -Xlinker -zmuldefs

LIB = -lf77blas -latlas -lcblas -lf2c -lcublas -lm
# on rhel bases this is in yum: compat-libf2c-34

CUDADIR = /usr/local/cuda

LIBDIR = -L$(CUDADIR)/lib64 \
-L/opt/usr/lib64 \
-L/usr/lib64 \
-L/usr/lib64/atlas
INC = -I$(CUDADIR)/include \
-I/opt/usr/include/libcblas

errors:

gcc -fPIC -Xlinker -zmuldefs -DGPUSHMEM=200 testing_zgemm.o -o testing_zgemm \
libtest.a lin/liblapacktest.a -L../lib -lmagma -lmagmablas -lmagma \
-L/usr/local/cuda/lib64 -L/opt/usr/lib64 -L/usr/lib64 -L/usr/lib64/atlas \
-lf77blas -latlas -lcblas -lf2c -lcublas -lm
testing_zgemm.o: In function `main':
testing_zgemm.cpp:(.text+0x49d): undefined reference to `zlarnv_'
testing_zgemm.cpp:(.text+0x4c2): undefined reference to `zlarnv_'
testing_zgemm.cpp:(.text+0x4e7): undefined reference to `zlarnv_'
testing_zgemm.cpp:(.text+0x802): undefined reference to `zlange_'
/usr/lib64/libf2c.so: undefined reference to `MAIN__'

and it does not matter having above make.inc if I amend src/dlaex1.cpp to use:

#define magma_dlaed2 FORTRAN_NAME( magma_dlaed2_, MAGMA_DLAED2_ )

still the same errors
lejeczek
 
Posts: 22
Joined: Tue Apr 09, 2013 2:57 am

Next

Return to User discussion

Who is online

Users browsing this forum: Bing [Bot] and 2 guests