MAGMA Shared libraries

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
evanlezar
Posts: 33
Joined: Tue Aug 25, 2009 7:20 pm
Location: Stellenbosch, South Africa
Contact:

MAGMA Shared libraries

Post by evanlezar » Sat Nov 28, 2009 5:27 pm

Hi

I am trying to build certain MAGMA functions into a shared library. The idea behind this is that I want a number of backends (CPU blas, MAGMA, ... etc) that adhere to a common interface for a benchmarking application that I am developing. I have tried to do this using the static libraries supplied with MAGMA by executing the following commands (scons output)

Code: Select all

g++ -o src/bends/LAPACK/bm_LAPACK_MAGMA-0.2.os -c -fPIC -I/usr/local/cuda/include -I/home/elezar/src/cuda/magma_0.2/include src/bends/LAPACK/bm_LAPACK_MAGMA-0.2.cpp
g++ -o lib/libbm_LAPACK_MAGMA-0.2.so -shared src/bends/LAPACK/bm_LAPACK_MAGMA-0.2.os -L/usr/local/cuda/lib64 -L/home/elezar/src/cuda/magma_0.2/lib -lcublas -lcuda -lmagma -lmagmablas
then obtain the following error on the second step:

Code: Select all

/usr/bin/ld: /home/elezar/src/cuda/magma_0.2/lib/libmagmablas.a(sinplace_transpose.cu_o): relocation R_X86_64_32 against `.nvFatBinSegment' can not be used when making a shared object; recompile with -fPIC
/home/elezar/src/cuda/magma_0.2/lib/libmagmablas.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
When I place the shared libraries posted on the forum in the same folder as the static libs, the compilation is successful, but when I run a simple LAPACK test program I get the following:

Code: Select all

OSError: /home/elezar/src/cuda/magma_0.2/lib/libmagmablas.so: undefined symbol: slamch_
Any suggestions?

Thanks

Evan Lezar

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

Re: MAGMA Shared libraries

Post by Stan Tomov » Sun Nov 29, 2009 12:32 am

Evan,
Function slamch is auxiliary LAPACK functions, and indeed is not defined in the magma or magmablas libraries. How did you manage to make the compiler link when you have something undefined? I make shared objects the way you do and it works. When you link with the shared libraries, and then try to run the executable, does your LD_LIBRARY_PATH variable have the path to all shared libraries used? I use lapack from MKL so I have in it the path to the MKL shared libraries and to the MAGMA shared libraries.
Stan

evanlezar
Posts: 33
Joined: Tue Aug 25, 2009 7:20 pm
Location: Stellenbosch, South Africa
Contact:

Re: MAGMA Shared libraries

Post by evanlezar » Sun Nov 29, 2009 3:55 pm

Just an update.

I found my error. I was not linking in lapack (DOH). What was throwing me off was the fact that when I included lapack the following error occured

Code: Select all

OSError: /home/elezar/src/cuda/magma_0.2/lib/libmagma.so: undefined symbol: magma_get_dgeqrf_nb
Which I foolishly thought was due to lapack incompatibilities. After reading through some forum posts, it dawned on me that this is actually due to the routines in the get_np.cpp file in the testing folder not being present and adding this to the shared library sources had the desired result.

Thanks for the assistance.

Evan

camejia
Posts: 1
Joined: Tue May 25, 2010 12:34 am

Re: MAGMA Shared libraries

Post by camejia » Tue May 25, 2010 12:39 am

Hi,

I just discovered MAGMA, and am very excited to start using it. I would like to call it from Python using ctypes, which would require a shared library. Earlier in this discussion thread there is reference to a "shared library that was posted on the forum", but I can't find it now. Is it still available somewhere? FYI, I'm using 64-bit Linux.

Thanks in advance for any information,
--Chris

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

Re: MAGMA Shared libraries

Post by Stan Tomov » Tue May 25, 2010 12:57 am

Hi,
Thanks for your interest in MAGMA. The 64-bit shared library was posted in topic
Matlab/nvmex - failure to compile
Stan

Post Reply