MAGMA 1.1.0 FORTRAN Linking

Open discussion for MAGMA

MAGMA 1.1.0 FORTRAN Linking

Postby fletchjp » Wed Jan 25, 2012 7:22 pm

I have some examples of FORTRAN code which I previously ran using MAGMA 1.0.0 RC4 and CUDA 3.2.
I now want to upgrade these to run with MAGMA 1.1.0 and CUDA 4.0

I am having problems with the linking which I can illustrate with the testing example testing_degetrf_gpu_f

In the magma_1.1.0/testing environment it links like this (noting that in MAGMA 1.1.0 the source code is *.f90)

Code: Select all
gfortran -O3 -DADD_ -x f95-cpp-input -Dmagma_devptr_t="integer(kind=8)" -I/usr/local/cuda/include -I../include -I../quark/include -c testing_dgetrf_gpu_f.f90 -o testing_dgetrf_gpu_f.o
gfortran -O3 -DADD_ -DGPUSHMEM=200 -fPIC -Xlinker -zmuldefs -DGPUSHMEM=200 testing_dgetrf_gpu_f.o fortran.o -o testing_dgetrf_gpu_f lin/liblapacktest.a -L../lib \
          -lcuda -lmagma -lmagmablas -lmagma -L/home/fletcher/GotoBLAS2 -L/usr/lib64 -L/usr/local/cuda/lib64  -lgoto2  -lpthread -lcublas -lcudart -llapack -lm 
rm testing_dgetrf_gpu_f.o
make[1]: Leaving directory `/home/fletcher/magma_1.1.0/testing'

I had based my own work on the testing code which came with MAGMA 1.0.0-RC4. When I link the old code with MAGMA 1.1.0 it fails to find the library code for magma_dgetrs_gpu and magma_dgetrf_gpu as follows:

Code: Select all
fletcher@fletcher-desktop:~/sotos/super3drun3$ make testing_dgetrf_gpu_f
gfortran -O3 -DADD_ -x f95-cpp-input -Dmagma_devptr_t="integer(kind=8)" -DGPUSHMEM=200 -I/usr/local/cuda/include -I/home/fletcher/magma_1.1.0/include -c testing_dgetrf_gpu_f.f -o testing_dgetrf_gpu_f.o
gfortran -O3 -DADD_ -DGPUSHMEM=200 -fPIC -Xlinker -zmuldefs -DGPUSHMEM=200 testing_dgetrf_gpu_f.o /home/fletcher/magma_1.1.0/testing/fortran.o -o testing_dgetrf_gpu_f /home/fletcher/magma_1.1.0/testing/lin/liblapacktest.a -L/home/fletcher/magma_1.1.0/lib \
          -lcuda -lmagma -lmagmablas -lmagma -L/home/fletcher/GotoBLAS2 -L/usr/lib64 -L/usr/local/cuda/lib -lgoto2  -lpthread -lcublas -lcudart -lm -Xlinker -R/home/fletcher/magma_1.1.0/lib -Xlinker -R/usr/local/cuda/lib -Xlinker -R/home/fletcher/GotoBLAS2
testing_dgetrf_gpu_f.o: In function `MAIN__':
testing_dgetrf_gpu_f.f:(.text+0x3f3): undefined reference to `magma_dgetrf_gpu_'
testing_dgetrf_gpu_f.f:(.text+0x468): undefined reference to `magma_dgetrs_gpu_'
collect2: ld returned 1 exit status
make: *** [testing_dgetrf_gpu_f] Error 1

If I use instead the testing code from MAGMA 1.1.0 (which is *.f90) it works again, so the library is available.

Is it not possible to link *.f files? What is happening to cause this problem with FORTRAN linking.

I have looked in the Release Notes but can find no note of these changes.

Thank you

Posts: 175
Joined: Mon Dec 27, 2010 7:29 pm

Re: MAGMA 1.1.0 FORTRAN Linking

Postby fletchjp » Wed Jan 25, 2012 8:04 pm

I have found the answer to my problem. It was in the ReleaseNotes, for 1.0.0 RC5

Code: Select all
 1.0.0RC5 - April 6th, 2011
    * WARNING: fix bug with fortran compilers which don;t change the name
      now fortran prefix is magmaf instead of magma

So the names of the routines have changed - hence the linkage failure.

Also the device pointer type has changed. After that is sorted my code does run.

I will leave this here to as a pointer for anyone else updating FORTRAN code.

I have had a dig through the archives of this forum and I cannot find anywhere a message to draw attention to this entry in the release notes for RC5 that the changes would break existing code calling magma routines from FORTRAN.

It would be helpful in future to have attention brought to things which break existing code. This will be known to you as you will have had to change all the testing files.

Posts: 175
Joined: Mon Dec 27, 2010 7:29 pm

Return to User discussion

Who is online

Users browsing this forum: Google [Bot] and 3 guests