PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Need some help in linking Magma
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Ragavan



Joined: 30 May 2012
Posts: 7

PostPosted: Thu May 31, 2012 2:49 pm    Post subject: Unable to find magma_dsygvd Reply with quote

Hi Mat,

Thnku so much.
Now, the compiler is unable to find the magma_dsygvd.
But in the module, its bound to the magma_dsygvd routine.


pgf90 -Mcuda -c magmatest2.f90
pgf90 -Mcuda -o magmatest2 magmatest2.o -L /sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib -R /sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib/ -lmagma -lmagmablas -lcublas -lcuda -lm
magmatest2.o: In function `main':
/nics/c/home/krajag1/Research/./magmatest2.f90:45: undefined reference to `magma_dsygvd'
make: *** [magmatest2] Error 2
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6119
Location: The Portland Group Inc.

PostPosted: Fri Jun 01, 2012 11:02 am    Post subject: Reply with quote

Hi Ragavan,

How does the "magma_dsygvd" symbol show up in the Magma libraries?

To check run "nm libmagma.a | grep magma_dsygvd" or "nm libmagmablas.a | grep magma_dsygvd".

Adjust the above commands as needed.

Also, what compiler did you use to build Magma?

- Mat
Back to top
View user's profile
Ragavan



Joined: 30 May 2012
Posts: 7

PostPosted: Fri Jun 01, 2012 12:08 pm    Post subject: Reply with quote

[quote="mkcolg"]Hi Ragavan,

How does the "magma_dsygvd" symbol show up in the Magma libraries?

To check run "nm libmagma.a | grep magma_dsygvd" or "nm libmagmablas.a | grep magma_dsygvd".

I got the foll when I tried nm libmagma.a | grep magma_dsygvd

U magma_dsygvd
0000000000000000 r _ZZ12magma_dsygvdE12__FUNCTION__
0000000000000014 b _ZZ12magma_dsygvdE4lopt
000000000000000c b _ZZ12magma_dsygvdE5liopt
0000000000000024 b _ZZ12magma_dsygvdE5lower
0000000000000010 b _ZZ12magma_dsygvdE5lwmin
0000000000000020 b _ZZ12magma_dsygvdE5trans
000000000000001c b _ZZ12magma_dsygvdE5wantz
0000000000000008 b _ZZ12magma_dsygvdE6liwmin
0000000000000018 b _ZZ12magma_dsygvdE6lquery
0000000000000000 b _ZZ12magma_dsygvdE6stream
0000000000000000 T magma_dsygvd


Also, what compiler did you use to build Magma?

I am running this code on keeneland supercomputer and from the makefile sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/make.inc it appears like they ve used gnu compilers.


#//////////////////////////////////////////////////////////////////////////////
# -- MAGMA (version 1.0) --
# Univ. of Tennessee, Knoxville
# Univ. of California, Berkeley
# Univ. of Colorado, Denver
# November 2010
#//////////////////////////////////////////////////////////////////////////////

#
# GPU_TARGET specifies for which GPU you want to compile MAGMA
# 0: Tesla family
# 1: Fermi Family
#
GPU_TARGET = 1

CC = gcc
NVCC = nvcc
FORT = gfortran

ARCH = ar
ARCHFLAGS = cr
RANLIB = ranlib

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

#LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lcublas -lm
LIB = -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lcublas -lm

CUDADIR = /sw/keeneland/cuda/4.0/linux_binary

LIBDIR = -L/opt/intel/composerxe-2011.1.107/mkl/lib/intel64 \
-L/opt/intel/Compiler/11.1/038/lib/intel64 \
-L$(CUDADIR)/lib64
INC = -I$(CUDADIR)/include

LIBMAGMA = ../lib/libmagma.a
LIBMAGMABLAS = ../lib/libmagmablas.a
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6119
Location: The Portland Group Inc.

PostPosted: Fri Jun 01, 2012 1:50 pm    Post subject: Reply with quote

Quote:
U magma_dsygvd
..
0000000000000000 T magma_dsygvd
Hmm. It's there so I'm unclear why the linker is not resolving it. Though, it is odd there's an unresolved reference (the U) as well, Could this be from the magamblas lib?

Try linking with the verbose flag (-v) and let's see what's happening under the hood. Also, let's remove the "-R" flag since it might be trying to dynamically link the magma libs. Finally, add a second "-lmagma" in case magmablas references magma.

Code:
pgf90 -v -Mcuda -o magmatest2 magmatest2.o -L /sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib -lmagma -lmagmablas -lcublas -lcuda -lm -lmagma


- Mat
Back to top
View user's profile
Ragavan



Joined: 30 May 2012
Posts: 7

PostPosted: Fri Jun 01, 2012 5:22 pm    Post subject: Reply with quote

Hi Mat,

The errors were due to missing lapack and blas libraries in the linker.
Here`s the final makefile:

pgfortran -Mcuda -c magmatest2.f90
pgfortran -v -Mcuda -o magmatest2 magmatest2.o -L/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib -lcuda -lmagma -lmagmablas -lmagma -lcublas -L/opt/intel/mkl/lib/intel64/ -L/sw/keeneland/cuda/4.0/linux_binary/lib64 -lmkl_intel_lp64 -lmkl_pgi_thread -lmkl_core -mp -lpthread -lcudart -lm -pgf90libs

/usr/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /nics/e/sw/local/keeneland/opt/pgi/12.3/linux86-64/12.3/lib/trace_init.o /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtbegin.o /nics/e/sw/local/keeneland/opt/pgi/12.3/linux86-64/12.3/lib/initmp.o /nics/e/sw/local/keeneland/opt/pgi/12.3/linux86-64/12.3/lib/f90main.o -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /nics/e/sw/local/keeneland/opt/pgi/12.3/linux86-64/12.3/lib/pgi.ld -L/sw/keeneland/magma/1.1/centos5.5_gnu4.4/magma_1.1.0/lib -L/opt/intel/mkl/lib/intel64/ -L/sw/keeneland/cuda/4.0/linux_binary/lib64 -L/nics/e/sw/local/keeneland/opt/pgi/12.3/linux86-64/12.3/lib -L/usr/lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 magmatest2.o -lcuda -lmagma -lmagmablas -lmagma -lcublas -lmkl_intel_lp64 -lmkl_pgi_thread -lmkl_core -lpthread -lcudart -lm -rpath /nics/e/sw/local/keeneland/opt/pgi/12.3/linux86-64/12.3/lib -rpath /nics/e/sw/local/keeneland/opt/pgi/12.3/linux86-64/2012/cuda/4.0/lib64 -o magmatest2 -lcudafor4 -lcudaforblas4 -L/nics/e/sw/local/keeneland/opt/pgi/12.3/linux86-64/2012/cuda/4.0/lib64 -lcudart -lpgmp -lnuma -lpthread -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lnspgc -lpgc -lrt -lpthread -lm -lgcc -lc -lgcc /usr/lib/gcc/x86_64-redhat-linux/4.1.2/crtend.o /usr/lib64/crtn.o


Now, I am getting a seg fault from the magma call, when I try the same input data from http://www.nag.com/lapack-ex/node104.html

Thanks,
Ragavan
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group