Page 1 of 1

Linking errors compiling clMAGMA

Posted: Mon Oct 22, 2012 2:40 pm
by solenskiner
Hello

I am having some problems getting clMAGMA to compile, which I hope I can have some help with. When compiling clMAGMA I get the error:

Code: Select all

g++ -O0 -DADD_ -g -Wall -DHAVE_clAmdBlas -DHAVE_CBLAS -fPIC -Xlinker -zmuldefs  testing_zpotrf_gpu.o  -o testing_zpotrf_gpu lin/liblapacktest.a \
        -L../lib -lclmagma -lclmagmablas -L/usr/local/bin/acml/gfortran64/lib -L/usr/local/bin/acml/gfortran64_mp/lib -L/usr/local/bin/clAmdBlas/lib64 -lacml_mp -lacml_mv -lclAmdBlas -lOpenCL 
../lib/libclmagma.a(magmablas_z.o): In function `magma_zher2k':
/home/floyd/Downloads/amd/clmagma-0.3.0/interface_opencl/magmablas_z.cpp:378: undefined reference to `cblas_zher2k'
collect2: error: ld returned 1 exit status
make[1]: *** [testing_zpotrf_gpu] Error 1
make[1]: Leaving directory `/home/floyd/Downloads/amd/clmagma-0.3.0/testing'
make: *** [test] Error 2
It seems clMAGMA is not compatible with the ACML version 5.2 or clAmdBlas 1.8 or that I have made a mistake somewhere. I attached my make.ink just in case.

Thank you kindly,

Re: Linking errors compiling clMAGMA

Posted: Thu Oct 25, 2012 5:14 am
by mb_infn_it
solenskiner wrote:g++ -O0 -DADD_ -g -Wall -DHAVE_clAmdBlas -DHAVE_CBLAS -fPIC -Xlinker -zmuldefs testing_zpotrf_gpu.o -o testing_zpotrf_gpu lin/liblapacktest.a \
-L../lib -lclmagma -lclmagmablas -L/usr/local/bin/acml/gfortran64/lib -L/usr/local/bin/acml/gfortran64_mp/lib -L/usr/local/bin/clAmdBlas/lib64 -lacml_mp -lacml_mv -lclAmdBlas -lOpenCL
../lib/libclmagma.a(magmablas_z.o): In function `magma_zher2k':
/home/floyd/Downloads/amd/clmagma-0.3.0/interface_opencl/magmablas_z.cpp:378: undefined reference to `cblas_zher2k'
collect2: error: ld returned 1 exit status
make[1]: *** [testing_zpotrf_gpu] Error 1
make[1]: Leaving directory `/home/floyd/Downloads/amd/clmagma-0.3.0/testing'
make: *** [test] Error 2
You're trying to compile source against cblas lib (-DHAVE_CBLAS) without linking it.
That function `cblas_zher2k' is referred to standard cblas lib, and not to clAmdBlas, so it can be provided in different ways.
If you're compiling under linux system, it will simply fix by installing gsl lib http://www.gnu.org/software/gsl/ on your machine and adding -lgsl when compiling that source. You can add -lgsl in make.inc here:

Code: Select all

...
LIB	  += -lOpenCL -lgsl -lclAmdBlas
...

Re: Linking errors compiling clMAGMA

Posted: Thu Oct 25, 2012 1:41 pm
by mgates3
Right, ACML doesn't provide CBLAS, which is a C-interface wrapper around the Fortran BLAS routines. You can obtain CBLAS from
http://www.netlib.org/blas/blast-forum/cblas.tgz
After installing CBLAS, add -lcblas to LIB in make.inc.
-mark

Re: Linking errors compiling clMAGMA

Posted: Thu Dec 06, 2012 12:33 pm
by solenskiner
Oh sorry, thought i would get an email on response. I'll try that out this weekend. Thanks!