Linking problem

Open discussion for MAGMA

Linking problem

Postby Valentin33 » Mon Jul 16, 2012 12:11 pm

Hi,

After compiling with success magma and the testing programs, I'm having trouble while trying to use a magma function in my own program (C++ with calls to MAGMA GPU function)

I'm having the folowing error : main.cpp:(.text+0x2c92): undefined reference to `magma_spotrf_gpu'

In my main.cpp, I have the #include <magma.h> to have this magma_spotrf_gpu defined in magma_s.h header.

My Makefile is the folowing one :
Code: Select all
CC              := icpc -DADD_
CFLAGS          += -O3 -DMKL_ILP64 -m64 -I$(CUDA_INC) -I$(MKL_INC) -I($MAGMA_ROOT)/include
LDFLAGS         := -L$(CUDA_LIB) -L$(MKL_LIB) -L($MAGMA_ROOT)/lib
LDLIBS          := -lmagma -lmagmablas -lmagma -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_lapack95_ilp64 -lmkl_core -liomp5 -lpthread -lcublas -lcudart -lm


What am I doing wrong ?

Also, the result of "nm $MAGMAROOT/lib/libmagma.a | grep magma_spotrf_gpu" results in :

Code: Select all
                 U magma_spotrf_gpu
                 U magma_spotrf_gpu
                 U magma_spotrf_gpu
0000000000000000 T magma_spotrf_gpu
                 U magma_spotrf_gpu
                 U magma_spotrf_gpu


Thanks for you help.

Bye
Valentin33
 
Posts: 2
Joined: Mon Jul 16, 2012 12:01 pm

Re: Linking problem

Postby mgates3 » Tue Jul 17, 2012 11:02 am

Not sure that this is the problem, but the $ on your magma variables is inside the parens. It should be outside.
-mark
mgates3
 
Posts: 438
Joined: Fri Jan 06, 2012 2:13 pm

Re: Linking problem

Postby Valentin33 » Tue Jul 17, 2012 6:02 pm

mgates3 wrote:Not sure that this is the problem, but the $ on your magma variables is inside the parens. It should be outside.
-mark

Hi,
Indeed, while trying to make my Makefile easier to read for you on the forum, I replace the magma path with this MAGMA_ROOT variable and made a mistake with this $ inside the parens.
The real problem was that compiling magma produce a static library, that I added in the dynamic library variable in my Makefile. This was a mistake, because it was linked before any object file. The solution was to put these static library after the object files in the compilation line.

The solution looks like :
Code: Select all
CC              := icpc -DADD_
CFLAGS          += -O3 -DMKL_ILP64 -m64 -I$(CUDA_INC) -I$(MKL_INC) -I$(MAGMA_ROOT)/include
LDFLAGS         := -L$(CUDA_LIB) -L$(MKL_LIB)
LIBS              :=  -L$(MAGMA_ROOT)/lib -lmagma -lmagmablas -lmagma
LDLIBS          := -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_lapack95_ilp64 -lmkl_core -liomp5 -lpthread -lcublas -lcudart -lm


Thanks for you reply anyway :-)
Valentin33
 
Posts: 2
Joined: Mon Jul 16, 2012 12:01 pm


Return to User discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron