MATLAB w/ CULA dense R13

Support for issues specific to the Linux operating systems.

MATLAB w/ CULA dense R13

Postby sobkowski » Mon Jan 23, 2012 5:50 am

Hello everyone,

we recently purchased CULA dense R13 and it is running fine on several Ubuntu 10.04 LTS systems.

However we're struggling to get the MATLAB Link interface going, as the tutorial posted in your blog is outdated and unfortunately does not apply to R13.
The cula_link.so library is no longer available and seems to be replaced by lib64/libcula_lapack_link.so. However there is no such thing as a blas_link.so

So far we have tried doing:
export LAPACK_VERSION=$CULA_ROOT/lib64/libcula_lapack_link.so
export CULA_DEBUG_LOG=~/debug.log
export CULA_ILP64=1
export LAPACK_VERBOSITY=1

After starting matlab:
< M A T L A B (R) >
Copyright 1984-2011 The MathWorks, Inc.
R2011b (7.13.0.564) 64-bit (glnxa64)
August 13, 2011


To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit http://www.mathworks.com.

>> randn('seed',1);A=randn(4000,4000,'single');
>> tic;svd(A);toc
cpu_id: x86 Family 6 Model 10 Stepping 5, GenuineIntel
libmwlapack: trying environment...
libmwlapack: loading /usr/local/cula/lib64/libcula_lapack_link.so
libmwlapack: loaded /usr/local/cula/lib64/libcula_lapack_link.so@0x7f9df87a6460
libmwlapack: /usr/local/cula/lib64/libcula_lapack_link.so is not a compatibility layer.
Elapsed time is 9.582482 seconds.
>>

The debug.log reads:
cula info: sgesvd (N, N, 4000, 4000, 0x7f42627af010, 4000, 0x33d41e0, (nil), 4000, (nil), 4000)
cula info: issuing to CPU (work query)
cula info: CPU library is lapackcpu.so
cula error: failed to read 'lapackcpu.so: cannot open shared object file: No such file or directory'
cula info: sgesvd (N, N, 4000, 4000, 0x7f42627af010, 4000, 0x33d41e0, (nil), 4000, (nil), 4000)
cula info: issuing to GPU (over threshold)
cula info: done

It seems like it is successfully issuing the code to GPU, but still returns errors.
What is the recommended way to implement a CULA Matlab link under Linux x64?

Any help would be greatly appreciated. Thanks!
Christian
sobkowski
 
Posts: 3
Joined: Mon Jan 23, 2012 5:32 am

Re: MATLAB w/ CULA dense R13

Postby john » Mon Jan 23, 2012 7:57 am

The fix here is pretty simple, just point LD_LIBRARY_PATH at your $CULA_ROOT/lib64 folder and lapackcpu.so will be loaded just fine.

As for the BLAS question, you can safely set both LAPACK_VERSION and BLAS_VERSION to cula_lapack_link.so. You might find some additional modest speedups from pointing Matlab's BLAS to CULA.

I'll make a note to update that blog post to reflect the updated filenames - thank you for pointing that out.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: MATLAB w/ CULA dense R13

Postby sobkowski » Mon Jan 23, 2012 8:20 am

Thank you John.
Up till now, we set the environment-variables via /etc/ld.so.conf.d/cula.conf:
/usr/local/cula/lib32
/usr/local/cula/lib64

However by explicitly setting the LD_LIBRARY_PATH, we did indeed experience a significant speedup of the calculations.
It'd be useful to include this fact in the documentation. :)
sobkowski
 
Posts: 3
Joined: Mon Jan 23, 2012 5:32 am

Re: MATLAB w/ CULA dense R13

Postby john » Mon Jan 23, 2012 8:56 am

Ah okay, I see. I'm glad it worked. So for details, CULA uses dlopen() to find that particular file. dlopen() definitely checks LD_LIBRARY_PATH - I'm not certain if it interacts with ld.so.conf or not, but it might be possible that you can clean that up by running ldconfig.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: MATLAB w/ CULA dense R13

Postby sobkowski » Mon Jan 23, 2012 9:00 am

We do have the ldconfig command in our thrown-together CULA install script, so I reckon dlopen() only checks the LD_LIBRARY_PATH.

No big deal once you know where to look.

Cheers for your fast help!
sobkowski
 
Posts: 3
Joined: Mon Jan 23, 2012 5:32 am

Re: MATLAB w/ CULA dense R13

Postby morphable » Wed Aug 07, 2013 8:33 am

Hi everyone,

I am unfortunately struggling to run it under CentOS 6.3. I have tried all the manipulations, I have also tried with Matlab's function "setenv", but nothing displays and it seems like the linking is not working. I've tried this :

export LAPACK_VERSION=/usr/local/cula/lib64/libcula_lapack_link.so
export BLAS_VERSION=/usr/local/cula/lib64/libcula_lapack_link.so
export CULA_DEBUG_LOG=~/debug.log
export CULA_ILP64=1
export LAPACK_VERBOSITY=1
export LD_LIBRARY_PATH=/usr/local/cula/lib64/

And here's the matlab script :

setenv('KMP_DUPLICATE_LIB_OK', 'TRUE');
setenv('LAPACK_VERSION','/usr/local/cula/lib64/libcula_lapack_link.so');
setenv('BLAS_VERSION','/usr/local/cula/lib64/libcula_lapack_link.so');
setenv('CULA_ILP64','1');
setenv('CULA_VERBOSE','1');
setenv('CULA_DEBUG_LOG','~/debug.log');
new_path=[':' '/usr/local/cula/lib64/'];
setenv('LD_LIBRARY_PATH',[getenv('LD_LIBRARY_PATH') new_path]);

Cheers,
Morphable
morphable
 
Posts: 1
Joined: Mon Aug 05, 2013 5:02 am

Re: MATLAB w/ CULA dense R13

Postby john » Wed Aug 07, 2013 1:39 pm

I don't have anything near to this configuration available to me for testing, so I'm not sure if I can assist at all.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm


Return to Linux Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron