Using MAGMA without Intel MKL

Open discussion for MAGMA

Using MAGMA without Intel MKL

Postby itzsid » Sun Nov 15, 2009 2:48 am

Is it possible to use the magma library without Intel MKL ?
itzsid
 
Posts: 9
Joined: Sun Nov 15, 2009 2:34 am

Re: Using MAGMA without Intel MKL

Postby danilo » Sun Nov 15, 2009 9:25 am

Hi,
yes it's possible! You have to modify the make.inc file in the main directory. If you download magma you'll see different make.inc file for different commercial LAPACK and BLAS (gotoBlas, Atlas, ACML, MKL, ecc..). These are only few examples and if you have different BLAS or LAPACK installed on your system you have only to modify make.inc including the correct library names and paths.

Danilo
danilo
 
Posts: 7
Joined: Thu Oct 29, 2009 6:20 am

Re: Using MAGMA without Intel MKL

Postby itzsid » Sun Nov 15, 2009 12:47 pm

Actually I installed Intel MKL 10.2, but I am getting the error:

/usr/bin/ld: cannot find -lmkl_em64t
collect2: ld returned 1 exit status

I checked the library directory but could not find any library of libmkl_em64t.a , Is there any new name for that ?
itzsid
 
Posts: 9
Joined: Sun Nov 15, 2009 2:34 am

Re: Using MAGMA without Intel MKL

Postby Stan Tomov » Sun Nov 15, 2009 10:16 pm

Hi,
Yes, we knew Intel has removed some "dummy" libraries in MKL 10.2
http://software.intel.com/en-us/article ... n-removed/
They provide a tool on how to get the correct linking sequence
http://software.intel.com/en-us/article ... e-advisor/
We will also try the new version and post the correct linking shortly. Meanwhile, if you figure it out, please post it.
Thanks,
Stan
Stan Tomov
 
Posts: 247
Joined: Fri Aug 21, 2009 10:39 pm

Re: Using MAGMA without Intel MKL

Postby itzsid » Mon Nov 16, 2009 7:12 am

The flags, -lmkl_sequential -lmkl_intel -lmkl_core -lguide worked for me with MKL 10.2 .

Another problem I am getting is linking MAGMA to a C (not CPP) Project. It is not able to find definition of the magma functions. As far as I think, the magma codes are written in cpp and all the test files are written in cpp, So calling C functions from CPP is not a major problem. But in my case, I need to call magma libraries from CPP code.
itzsid
 
Posts: 9
Joined: Sun Nov 15, 2009 2:34 am

Re: Using MAGMA without Intel MKL

Postby itzsid » Mon Nov 16, 2009 12:23 pm

Hi,

I am currently using the Cholesky decomposition module of MAGMA. So I need to link this module with rest of the "C" Project. But with the existing modules, I couldn't link it successfully. Could you provide with the code for magma_dpotrf and magma_get_dpotrf_nb .


Thanks
itzsid
 
Posts: 9
Joined: Sun Nov 15, 2009 2:34 am

Re: Using MAGMA without Intel MKL

Postby gaurav » Mon Nov 16, 2009 1:35 pm

I have MKL 10.2.2.25. I replaced "-lmkl_em64t" with "-lmkl_sequential -lmkl_intel_lp64 -lmkl_core" and it works for me.
gaurav
 
Posts: 6
Joined: Thu Aug 13, 2009 1:20 pm

Re: Using MAGMA without Intel MKL

Postby Stan Tomov » Mon Nov 16, 2009 2:43 pm

We are going to release MAGMA 0.2 today or tomorrow and we will fix the problem of linking with "C" Projects. Thanks for pointing it out. Until we do that, the easiest fix for you would be if you rename the file from where you call magma_dpotrf from .c to .cpp and wrap the C function declarations that you use in the file in extern "C" { ... }, e.g.
Code: Select all
#ifdef __cplusplus
extern "C" {
#endif

int function1(...);
int function2 (...);

#ifdef __cplusplus
}
#endif
Stan Tomov
 
Posts: 247
Joined: Fri Aug 21, 2009 10:39 pm

Re: Using MAGMA without Intel MKL

Postby itzsid » Mon Nov 16, 2009 3:36 pm

I used
extern "C" int magma_dpotrf(char *, int *, double *, int *, double *, int *); in magma.h and called the function
but it gave error: magma_dpotrf.cpp:(.text+0xa1): undefined reference to `magma_get_dpotrf_nb'
while linking it. I tried changing the declaration in auxilliary.h but of no use.
itzsid
 
Posts: 9
Joined: Sun Nov 15, 2009 2:34 am

Re: Using MAGMA without Intel MKL

Postby Stan Tomov » Mon Nov 16, 2009 4:25 pm

magma_get_dpotrf_nb is defined in file get_nb.cpp that you have in the testing directory. Just putting
extern "C" int magma_dpotrf( ...
may not work because the library is already compiled as if it is cpp code and the functions are defined in certain way. For example, I get the following
Code: Select all
[tomov@cumin testing]$ nm ../lib/libmagma.a | grep magma_dgetrf
0000000000000000 T _Z12magma_dgetrfPiS_PdS_S_S0_S0_S_
0000000000000000 T _Z16magma_dgetrf_gpuPiS_PdS_S_S0_S_

Now, if I check what I need in my testing_dgetrf.o in order to compile it
Code: Select all
[tomov@cumin testing]$ nm testing_dgetrf.o | grep magma_dgetrf
                 U _Z12magma_dgetrfPiS_PdS_S_S0_S0_S_

i.e. I can link the above code with the library. But if I do
Code: Select all
[tomov@cumin testing]$ cp testing_dgetrf.cpp testing_dgetrf.c
[tomov@cumin testing]$ gcc -O3 -DADD_ -I../include -I/usr/local/cuda/include -c testing_dgetrf.c -o testing_dgetrf.o
[tomov@cumin testing]$ nm testing_dgetrf.o | grep magma_dgetrf
                 U magma_dgetrf

and try to link this code with the library it will fail because of the name mangling that is going on (just magma_dgetrf is not defined in the library; what is defined is _Z12magma_dgetrf...). That's why I am saying the easiest way may be if you don't change anything in the magma library but name the file from where you call magma_dgetrf with a .cpp extension. Than magma_dgetrf would be defined as it is in the library and you would be able to link it.
Stan Tomov
 
Posts: 247
Joined: Fri Aug 21, 2009 10:39 pm

Next

Return to User discussion

Who is online

Users browsing this forum: No registered users and 4 guests