Search code examples
fortranshared-librariesmagma

Running Magma library


I'm trying to run one of the examples given with the source. for the MAGMA library (http://icl.cs.utk.edu/magma/) on my GPU. I installed MAGMA through the arch user repository and after setting the paths correctly I can built it fine:

make all                                                                                            [±master ●]
gcc -Wall -DADD_ -I/opt/magma/include -I/opt/cuda/include -c -o example_v1.o example_v1.c
gcc -Wall -o example_v1 example_v1.o -L/opt/magma/lib -L/opt/cuda/lib64 -L/usr/local/openblas/lib -llapack -lmagma -lcublas -lcudart -lopenblas
gcc -Wall -DADD_ -I/opt/magma/include -I/opt/cuda/include -c -o example_v2.o example_v2.c
gcc -Wall -o example_v2 example_v2.o -L/opt/magma/lib -L/opt/cuda/lib64 -L/usr/local/openblas/lib -llapack -lmagma -lcublas -lcudart -lopenblas
gfortran  -I/opt/magma/include -Dmagma_devptr_t="integer(kind=8)" -c -o example_f.o example_f.F90
gcc -Wall -DADD_ -I/opt/magma/include -I/opt/cuda/include -DCUBLAS_GFORTRAN -c -o fortran.o /opt/cuda/src/fortran.c
gfortran -Wall -o example_f example_f.o fortran.o -L/opt/magma/lib -L/opt/cuda/lib64 -L/usr/local/openblas/lib -llapack -lmagma -lcublas -lcudart -lopenblas

But when I run it I get:

./example_v2                                                                                       [±master ●●]
./example_v2: error while loading shared libraries: libmagma.so: cannot open shared object file: No such file or directory

This is the whole makefile: http://pastebin.com/dhrszsP4

How can I run the MAGMA examples?


Solution

  • After adding

    if [ -n "/opt/magma/lib" ] ; then
        export LD_LIBRARY_PATH="/opt/magma/lib:$LD_LIBRARY_PATH"
    fi
    

    to my .zshrc it worked.