Link problems on Windows 7

Hi,

I’m trying to run the JCuda sample application. It compiles fine, but fails to link correctly:

Error while loading native library with base name „JCudaRuntime“
Operating system name: Windows 7
Architecture : x86
Architecture bit size: 32
Stack trace:
java.lang.UnsatisfiedLinkError: C:\Users\steve\Desktop\JCuda-All-0.2.3-bin-windows-x86_64\JCuda-All-0.2.3-bin-windows-x86_64\JCudaRuntime-windows-x86.dll: %1 ist keine zulässige Win32-Anwendung
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at jcuda.LibUtils.loadLibrary(LibUtils.java:53)
at jcuda.runtime.JCuda.assertInit(JCuda.java:227)
at jcuda.runtime.JCuda.initialize(JCuda.java:209)
at JCudaRuntimeSample.main(JCudaRuntimeSample.java:33)
<<<

System in use: JAVA 6, 64-bit Windows 7 system

As far as I understand the error message, Windows 7 locates the respective JCudaRuntime-windows-x86.dll, but fails to load it.

Could someone explain why?

Kind regards,

Stefan

Hello Stefan,

According to the output


Architecture bit size: 32
Architecture : x86

you are most likely trying to run the example with a 32bit Java VM. (Although the error message seems unusual: When trying to load a 32bit DLL on a 64bit system, the error message should roughly be something like ~“Cannot load a IA-32 bit library on an AMD64 system”). Please make sure that you are using a 64bit JVM. Depending on your IDE and execution environment, this means that you should use the JRE/JDK that is located in “Program Files”, and not the one that is located in “Program Files (x86)”.

Hope that helps.

Hello Marco,

Ah, interesting. Other Java apps run just fine. Eclipse itself launches as expected.

Doesn’t Win7 launch the VM as 32bit or as 64bit process - depending on the architecture, the VM app was compiled for?

(Although the error message seems unusual: When trying to load a 32bit DLL on a 64bit system, the error message should roughly be something like ~„Cannot load a IA-32 bit library on an AMD64 system“). Please make sure that you are using a 64bit JVM. Depending on your IDE and execution environment, this means that you should use the JRE/JDK that is located in „Program Files“, and not the one that is located in „Program Files (x86)“.

Yes, somehow strange.

For Applications that no not use native DLLs there will be no problem. But the error message suggests that the JVM is a 32bit version (and I noticed that it’s not an error due to compatibility problems: It tries to load the “JCudaRuntime-windows-x86.dll”, which is not even contained in the binaries pacakage for Windows 64. It should try to load the “JCudaRuntime-windows-x86**_64**.dll” …)

Have you tried to start it with a 64bit JVM? If you have a 64bit JVM installed, it should be possible to do something like the following in Eclipse:
Open the Run dialog for the Application -> Select the JRE Tab -> Select “Alternate JRE”
Click “Installed JREs” -> Click “Add” -> Click “Browse”
Browse to “Program Files\Java\jdkX.X.X” (not to “Program Files (x86)”!)
Click “OK” -> Click “OK” -> Select the 64bit JRE in the Combo Box -> Click “Run”

It should then load the appropriate DLL.

If this still does not work: Which version of the CUDA driver and CUDA toolkit do you have installed? The binaries are compiled for CUDA 2.3…

EDIT: Doesn’t Win7 launch the VM as 32bit or as 64bit process - depending on the architecture, the VM app was compiled for?

I’m not sure about the internal processes Windows 7 is using, but the version of the JVM certainly has to match the version of the DLLs that will be loaded…

[QUOTE=Marco13]For Applications that no not use native DLLs there will be no problem. But the error message suggests that the JVM is a 32bit version (and I noticed that it’s not an error due to compatibility problems: It tries to load the „JCudaRuntime-windows-x86.dll“, which is not even contained in the binaries pacakage for Windows 64. It should try to load the „JCudaRuntime-windows-x86**_64**.dll“ …)
[/QUOTE]

Hm, my posting was misleading: Although the path-component indicated a 64bit release of JCuda, I in fact installed the 32bit and the 64bit releases of JCuda. Thus, the VM should have been able to load the required release.

Have you tried to start it with a 64bit JVM? If you have a 64bit JVM installed, it should be possible to do something like the following in Eclipse:
Open the Run dialog for the Application → Select the JRE Tab → Select „Alternate JRE“
Click „Installed JREs“ → Click „Add“ → Click „Browse“
Browse to "Program Files\Java\jdkX.X.X" (not to „Program Files (x86)“!)
Click „OK“ → Click „OK“ → Select the 64bit JRE in the Combo Box → Click „Run“

Thx! After my post, I installed the 64 bit JAVA (BETA) version for Windows 7. Additionally, I passed -D=64 to start the VM as 64bit version.

Et voilà, the source work as expected: JCublasSample.java performed 40x faster as a Core Quad using an NVidea GeForce 210.

Nice! Thank you, marco!

I have the same problems but any of your recommendations fixed the problem i’ve set the environment variables in their correct directory in order to made visible the cuda dll’s files, i have also put *jar and *dlls files in the root directory of the programm but i still have the same answer, i think i started to desperate myself.

Error while loading native library with base name “JCudaRuntime”
Operating system name: Windows XP
Architecture : x86
Architecture bit size: 32
java.lang.UnsatisfiedLinkError: Could not load native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:79)
at jcuda.runtime.JCuda.assertInit(JCuda.java:225)
at jcuda.runtime.JCuda.cudaMalloc(JCuda.java:1775)
at JCudaRuntimeGLSample3.main(JCudaRuntimeGLSample3.java:9)

The programm is too simple but it doesn´t work

[QUOTE=Unregistered]I have the same problems but any of your recommendations fixed the problem i’ve set the environment variables in their correct directory in order to made visible the cuda dll’s files, i have also put *jar and *dlls files in the root directory of the programm but i still have the same answer, i think i started to desperate myself.

Error while loading native library with base name “JCudaRuntime”
Operating system name: Windows XP
Architecture : x86
Architecture bit size: 32
java.lang.UnsatisfiedLinkError: Could not load native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:79)
at jcuda.runtime.JCuda.assertInit(JCuda.java:225)
at jcuda.runtime.JCuda.cudaMalloc(JCuda.java:1775)
at JCudaRuntimeGLSample3.main(JCudaRuntimeGLSample3.java:9)

The programm is too simple but it doesn´t work[/QUOTE]

I’m using windows XP OS

Hello

JCuda is mainly developed on 32bit XP, so I’d expect the least problems there.
Did you try the simple example from the FAQ (bottob, entitled “If all this does not help”) ?
Which version of the CUDA driver and toolkit do you have installed, and are you sure you have the matching JCuda version?
Can you run the native NVIDIA CUDA examples?

bye
Marco

I am facing the issue. what can be the problem?

Error while loading native library “JCudaRuntime-windows-x86” with base name “JCudaRuntime”
Operating system name: Windows 7
Architecture : x86
Architecture bit size: 32
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name ‘/lib/JCudaRuntime-windows-x86.dll’
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:144)
at jcuda.LibUtils.loadLibrary(LibUtils.java:80)
at jcuda.runtime.JCuda.initialize(JCuda.java:232)
at jcuda.runtime.JCuda.(JCuda.java:219)
at Executeclass.main(Executeclass.java:65)

System properties: Windows 7 32bit Eclipse.

how should i fix this? do i need to copy and paste the dll files somewhere?
Eisenhiem

Hello

Below the part of the Stack Trace you posted, there should be another one, starting with something like “Stack Trace from the attempt to load the library as a file”. This might be relevant as well. In general, the JCuda DLLs could (at least for the first tests) be located in one directory together with the .java- and .class files. If it works in general, a project with a more approriate directory structure may be set up.

bye