Hello,
I solved a problem with Jcuda (0.3.1) library with Netbeans (6.9.1) on MacOSX (10.6.4). Despite Jcuda works fine with java called with Terminal, I always get an UnsatisfiedLinkError problem with Netbeans :
Creating input data...
Performing Sgemm with JCublas...
Error while loading native library with base name "JCublas"
Operating system name: Mac OS X
Architecture : x86_64
Architecture bit size: 64
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:79)
at jcuda.jcublas.JCublas.assertInit(JCublas.java:174)
at jcuda.jcublas.JCublas.cublasInit(JCublas.java:198)
at cuda.JCublasSample.sgemmJCublas(JCublasSample.java:80)
at cuda.JCublasSample.testSgemm(JCublasSample.java:62)
at cuda.JCublasSample.main(JCublasSample.java:41)
Java Result: 1
It seems that Netbeans doesn’t load the user profile (the .profile file in the home directory), therefore if you defined global variables there, the JVM would not be able to run JCuda properly.
One solution is to call Netbeans from Terminal, open Terminal and type :
/Applications/NetBeans/NetBeans\ 6.9.1.app/Contents/MacOS/netbeans
But it is not very practical, I suggest another and permanent solution that consists to modify the launch script of Netbeans to include the profile configuration.
Open (with Textedit) /Applications/NetBeans/NetBeans 6.9.1.app/Contents/Resources/NetBeans/bin/netbeans and just after the copyright add :
# User profile
if [ -f ~/.profile ] ; then
source ~/.profile
fi
Save and that’s all. You can launch Netbeans from Apps folder only by clicking and JCuda will work fine !
Just for remind, here is my .profile :
# CUDA
export PATH=$PATH:/usr/local/cuda/bin
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/usr/local/cuda/lib64:/usr/local/cuda/lib
# JCUDA
export JCUDA=/JCUDA (the folder that contains Jcuda *.jar and *.jnilib files)
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:$JCUDA
export CLASSPATH=.:$JCUDA/jcublas-0.3.1.jar:$JCUDA/jcuda-0.3.1.jar:$JCUDA/jcudpp-0.3.1.jar:$JCUDA/jcufft-0.3.1.jar
I hope it could be helpful for someone, and sorry for my poor english.
PS: This kind of trips would probably work with Eclipse also.