我是JCuda。我試着在Eclipse上寫一個簡單的例子Linux。我有這個錯誤,但我不明白它的意思。下面的代碼:在eclipse中執行jcuda程序時出錯
import jcuda.Pointer;
import jcuda.runtime.JCuda;
public class cudaTest {
public static
void main(String[] args) {
Pointer pointer = new Pointer();
JCuda.cudaMalloc(pointer, 4);
System.out.println("Pointer: " + pointer);
JCuda.cudaFree(pointer);
}
}
我添加Jcuda.jar從Java構建路徑,並通過選擇提取JCuda文件編輯本機庫的位置。 錯誤是:
Error while loading native library "JCudaRuntime-linux-x86_64" with base name "JCudaRuntime"
Operating system name: Linux
Architecture : amd64
Architecture bit size: 64
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name '/lib/libJCudaRuntime-linux-x86_64.so'
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:151)
at jcuda.LibUtils.loadLibrary(LibUtils.java:83)
at jcuda.runtime.JCuda.initialize(JCuda.java:303)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:290)
at cudaTest.main(cudaTest.java:8)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: /home/Faith/JCuda-All-0.4.2-bin-linux-x86_64/libJCudaRuntime-linux-x86_64.so: libcudart.so.4: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at jcuda.LibUtils.loadLibrary(LibUtils.java:94)
at jcuda.runtime.JCuda.initialize(JCuda.java:303)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:290)
at cudaTest.main(cudaTest.java:8)
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load the native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:129)
at jcuda.runtime.JCuda.initialize(JCuda.java:303)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:290)
at cudaTest.main(cudaTest.java:8)
能土特產品請幫助我,我真的很需要的解決方案。先謝謝你。
請你能告訴我,我該怎麼辦,這時候我是第一次使用linux和cuda。我如何獲得這個文件? –
使用'find'從命令中找到一個文件,就像這個'find/-name'libJCudaRuntime-linux-x86_64.so'' – deimus
好了,但是如何製作一個符號鏈接到這個文件或者添加目錄的路徑找到它的ldconfig? –