jcuda-samples
jcuda-samples copied to clipboard
Version Problem?
I have installed the CUDA 11.1.1. Then I run the samples, I get the problem :Exception in thread "main" java.lang.UnsatisfiedLinkError: Error while loading native library "JCudaRuntime-11.1.1-windows-x86_64"
It might be. Try changing the version number to 11.1.0
in https://github.com/jcuda/jcuda-samples/blob/master/JCudaSamples/pom.xml#L11 . If this does not help, posting the full error message may be helpful.
It might be. Try changing the version number to
11.1.0
in https://github.com/jcuda/jcuda-samples/blob/master/JCudaSamples/pom.xml#L11 . If this does not help, posting the full error message may be helpful.
When I change the version number jcuda from 11.1.1 to 11.0.0. it can work.
Found 1 devices
Properties of device 0:
Device properties:
name=GeForce GTX 1650 Ti
uuid=cudaUUID[97f899494eb629110ab0c66e7b66b139]
luid=3eb8010000000000
luidDeviceNodeMask=1
totalGlobalMem=4294967296
sharedMemPerBlock=49152
...
But jcusolver can not run. Because , I need to solve sparse matrix. the matrix is very large. I want to use gpu to accelerate calculation speed.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error while loading native library "JCusparse-11.0.0-windows-x86_64"
Operating system name: Windows 10
Architecture : amd64
Architecture bit size: 64
---(start of nested stack traces)---
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: no JCusparse-11.0.0-windows-x86_64 in java.library.path: [E:\Program Files\Java\jdk-11.0.4\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\libnvvp, ., E:\Program Files (x86)\VMware\VMware Workstation\bin\, E:\Program Files\Tecplot\Tecplot Chorus 2019 R1\bin, E:\Program Files\Tecplot\Tecplot 360 EX 2019 R1\bin, C:\Program Files\Microsoft MPI\Bin\, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0\, C:\Windows\System32\OpenSSH\, C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common, E:\Program Files\Java\jdk-11.0.4\bin, E:\Program Files\graphviz\graphviz-2.38\release\bin, C:\Program Files\Microsoft SQL Server\130\Tools\Binn\, C:\Program Files\dotnet\, C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\, E:\Program Files\Git\cmd, E:\mysql\mysql-8.0.23-winx64\bin, E:\Program Files\nodejs\, E:\Program Files\nodejs, ., C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\WINDOWS\System32\OpenSSH\, C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.2.1\, C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR, E:\Users\winsw\AppData\Local\Programs\Python\Python37\Scripts\, E:\Users\winsw\AppData\Local\Programs\Python\Python37\, C:\Users\winsw\AppData\Local\Microsoft\WindowsApps, ., E:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\bin, ., E:\Microsoft VS Code\bin, E:\texlive\2020\bin\win32, D:\MyCode\JoyLibRelease/tool/bin, C:\Users\winsw\.dotnet\tools, C:\Users\winsw\AppData\Roaming\npm, .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
at java.base/java.lang.System.loadLibrary(System.java:1867)
at jcuda.LibUtils.loadLibrary(LibUtils.java:143)
at jcuda.jcusparse.JCusparse.initialize(JCusparse.java:77)
at jcuda.jcusparse.JCusparse.<clinit>(JCusparse.java:62)
at jcuda.jcusolver.samples.JCusolverDn_LinearSolver_Direct.main(JCusolverDn_LinearSolver_Direct.java:255)
Sorry for the delay here, and sorry for the possibly wrong information: I mentioned 11.1.0
, but the actual version number (that also matches the version of CUDA that you have installed) should be 11.1.1
. (In fact, 11.1.0
has never been released).
Regarding the error: It should print an additional stack trace, saying "Stack trace from the attempt to load the library as a resource", and this one might contain more helpful information. I guess it will say "Cannot find dependent libraries".
Specifically, you said
When I change the version number jcuda from 11.1.1 to 11.0.0. it can work.
Did you explicitly try it with 11.1.1
? This should work when you have installed CUDA 11.1. If it does not work, posting the (complete) stack trace might bring some insights.
Sorry for the delay here, and sorry for the possibly wrong information: I mentioned
11.1.0
, but the actual version number (that also matches the version of CUDA that you have installed) should be11.1.1
. (In fact,11.1.0
has never been released).Regarding the error: It should print an additional stack trace, saying "Stack trace from the attempt to load the library as a resource", and this one might contain more helpful information. I guess it will say "Cannot find dependent libraries".
Specifically, you said
When I change the version number jcuda from 11.1.1 to 11.0.0. it can work.
Did you explicitly try it with
11.1.1
? This should work when you have installed CUDA 11.1. If it does not work, posting the (complete) stack trace might bring some insights.
I change the pom the dependcy of jcuda to 11.1.1
<dependencies>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcuda</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcublas</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcufft</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcusparse</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcusolver</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcurand</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcudnn</artifactId>
<version>11.1.1</version>
</dependency>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcuda-vec</artifactId>
<version>0.0.2</version>
</dependency>
<dependency>
<groupId>de.javagl</groupId>
<artifactId>matrixmarketreader</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jcuda</groupId>
<artifactId>jcuda-matrix-utils</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.wendykierp</groupId>
<artifactId>JTransforms</artifactId>
<version>3.1</version>
<classifier>with-dependencies</classifier>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.lwjgl.lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>2.9.3</version>
</dependency>
And I run the class JCudaPrintDeviceInfo
to get some information. There are some errors asf follow.
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: no JCudaRuntime-11.1.1-windows-x86_64 in java.library.path: [E:\Program Files\Java\jdk-11.0.4\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\libnvvp, ., E:\Program Files (x86)\VMware\VMware Workstation\bin\, E:\Program Files\Tecplot\Tecplot Chorus 2019 R1\bin, E:\Program Files\Tecplot\Tecplot 360 EX 2019 R1\bin, C:\Program Files\Microsoft MPI\Bin\, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0\, C:\Windows\System32\OpenSSH\, C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common, E:\Program Files\Java\jdk-11.0.4\bin, E:\Program Files\graphviz\graphviz-2.38\release\bin, C:\Program Files\Microsoft SQL Server\130\Tools\Binn\, C:\Program Files\dotnet\, C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\, E:\Program Files\Git\cmd, E:\mysql\mysql-8.0.23-winx64\bin, E:\Program Files\nodejs\, E:\Program Files\nodejs, ., C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\WINDOWS\System32\OpenSSH\, C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.2.1\, C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR, E:\Users\winsw\AppData\Local\Programs\Python\Python37\Scripts\, E:\Users\winsw\AppData\Local\Programs\Python\Python37\, C:\Users\winsw\AppData\Local\Microsoft\WindowsApps, ., E:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\bin, ., E:\Microsoft VS Code\bin, E:\texlive\2020\bin\win32, D:\MyCode\JoyLibRelease/tool/bin, C:\Users\winsw\.dotnet\tools, C:\Users\winsw\AppData\Roaming\npm, .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
at java.base/java.lang.System.loadLibrary(System.java:1867)
at jcuda.LibUtils.loadLibrary(LibUtils.java:143)
at jcuda.runtime.JCuda.initialize(JCuda.java:468)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:452)
at jcuda.runtime.samples.JCudaPrintDeviceInfo.main(JCudaPrintDeviceInfo.java:21)
Stack trace from the attempt to load the library as a resource:
java.io.IOException: No resource found with name '/lib/JCudaRuntime-11.1.1-windows-x86_64.dll'
at jcuda.LibUtils.writeResourceToFile(LibUtils.java:323)
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:255)
at jcuda.LibUtils.loadLibrary(LibUtils.java:158)
at jcuda.runtime.JCuda.initialize(JCuda.java:468)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:452)
at jcuda.runtime.samples.JCudaPrintDeviceInfo.main(JCudaPrintDeviceInfo.java:21)
---(end of nested stack traces)---
at jcuda.LibUtils.loadLibrary(LibUtils.java:193)
at jcuda.runtime.JCuda.initialize(JCuda.java:468)
at jcuda.runtime.JCuda.<clinit>(JCuda.java:452)
at jcuda.runtime.samples.JCudaPrintDeviceInfo.main(JCudaPrintDeviceInfo.java:21)
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.859 s
Finished at: 2021-04-15T13:19:59+01:00
Final Memory: 10M/74M
------------------------------------------------------------------------
I just noticed that java.base/
part in the stack traces. There recently has been an issue about JCuda and the Java module system that might be related. I haven't understood/investigated this in all detail, and am not sure whether it would show up as this exact error message/stack trace.
A "back to the roots" test would be (very pragmatic)
- Create a directory
- Add https://repo1.maven.org/maven2/org/jcuda/jcuda/11.1.1/jcuda-11.1.1.jar
- Add https://repo1.maven.org/maven2/org/jcuda/jcuda-natives/11.1.1/jcuda-natives-11.1.1-windows-x86_64.jar
- Add http://www.jcuda.de/tutorial/JCudaRuntimeTest.java
- In the directory
- Run
javac -cp ".;jcuda-11.1.1.jar;jcuda-natives-11.1.1-windows-x86_64.jar" JCudaRuntimeTest.java
- Run
java -cp ".;jcuda-11.1.1.jar;jcuda-natives-11.1.1-windows-x86_64.jar" JCudaRuntimeTest
- Run
This should print some basic message about a pointer that has been created.
If this does not work, then the issue is almost certainly related to the module system, and I'll have to take another look at that.
Maybe @cfries : Do you know or remember whether the problem for you also showed up as a message that only said "No resource found with name '/lib/JCudaRuntime-11.1.1-windows-x86_64.dll'", without further details?
If this is the case, I'd like to try out the possible (simple) fix that was mentioned, about just changing the call to LibUtils.class.getClassLoader().getResourceAsStream(resourceName);
. (I'll have to install a newer Java version for that - I'm badly out of date here...)
I just noticed that
java.base/
part in the stack traces. There recently has been an issue about JCuda and the Java module system that might be related. I haven't understood/investigated this in all detail, and am not sure whether it would show up as this exact error message/stack trace.A "back to the roots" test would be (very pragmatic)
Create a directory
Add https://repo1.maven.org/maven2/org/jcuda/jcuda/11.1.1/jcuda-11.1.1.jar
Add https://repo1.maven.org/maven2/org/jcuda/jcuda-natives/11.1.1/jcuda-natives-11.1.1-windows-x86_64.jar
Add http://www.jcuda.de/tutorial/JCudaRuntimeTest.java
In the directory
- Run
javac -cp ".;jcuda-11.1.1.jar;jcuda-natives-11.1.1-windows-x86_64.jar" JCudaRuntimeTest.java
- Run
java -cp ".;jcuda-11.1.1.jar;jcuda-natives-11.1.1-windows-x86_64.jar" JCudaRuntimeTest
This should print some basic message about a pointer that has been created.
If this does not work, then the issue is almost certainly related to the module system, and I'll have to take another look at that.
Maybe @cfries : Do you know or remember whether the problem for you also showed up as a message that only said "No resource found with name '/lib/JCudaRuntime-11.1.1-windows-x86_64.dll'", without further details?
If this is the case, I'd like to try out the possible (simple) fix that was mentioned, about just changing the call to
LibUtils.class.getClassLoader().getResourceAsStream(resourceName);
. (I'll have to install a newer Java version for that - I'm badly out of date here...)
Yeah, I make a test for jcuda.
PS C:\Users\winsw\Desktop\Jcuda> java -version
java version "11.0.4" 2019-07-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)
PS C:\Users\winsw\Desktop\Jcuda> javac -cp ".;jcuda-11.1.1.jar;jcuda-natives-11.1.1-windows-x86_64.jar" JCudaRuntimeTest.java
PS C:\Users\winsw\Desktop\Jcuda> java -cp ".;jcuda-11.1.1.jar;jcuda-natives-11.1.1-windows-x86_64.jar" JCudaRuntimeTest
Pointer: Pointer[nativePointer=0x202e00000,byteOffset=0]
PS C:\Users\winsw\Desktop\Jcuda>
OK, that starts to get confusing. How exactly are you starting the JCudaPrintDeviceInfo
when you see the execption? I've seen that there is some Maven related output - do you run some magic command from an IDE there? Maybe the classpath/dependency reolution is not working properly. The native library is contained in the jcuda-natives-11.1.1-windows-x86_64.jar
, and when the small, standalone test works, it appears to not be related to the Java version in general...
OK, that starts to get confusing. How exactly are you starting the
JCudaPrintDeviceInfo
when you see the execption? I've seen that there is some Maven related output - do you run some magic command from an IDE there? Maybe the classpath/dependency reolution is not working properly. The native library is contained in thejcuda-natives-11.1.1-windows-x86_64.jar
, and when the small, standalone test works, it appears to not be related to the Java version in general...
Yeah, I run the command on the VScode, it is easy to use terminal. My Jcuda example was run on the Netbeans.
OK, that starts to get confusing. How exactly are you starting the
JCudaPrintDeviceInfo
when you see the execption? I've seen that there is some Maven related output - do you run some magic command from an IDE there? Maybe the classpath/dependency reolution is not working properly. The native library is contained in thejcuda-natives-11.1.1-windows-x86_64.jar
, and when the small, standalone test works, it appears to not be related to the Java version in general...
Dear sir, I found the problem that i depende on my native Jcuda. it make error. now it can work , thanks for your help.
OK, that starts to get confusing. How exactly are you starting the
JCudaPrintDeviceInfo
when you see the execption? I've seen that there is some Maven related output - do you run some magic command from an IDE there? Maybe the classpath/dependency reolution is not working properly. The native library is contained in thejcuda-natives-11.1.1-windows-x86_64.jar
, and when the small, standalone test works, it appears to not be related to the Java version in general...Yeah, I run the command on the VScode, it is easy to use terminal. My Jcuda example was run on the Netbeans.
sparse matrix A is 900 x 900 with 7744 nonzeros, base=0 step 2: convert CSR(A) to dense matrix step 3: set right hand side vector (b) to 1 step 4: prepare data on device step 5: solve Ax = b timing: cholesky = 0.014470 sec step 6: evaluate residual |b - Ax| = 1.136868E-13 |A| = 1.600000E+01 |x| = 2.357708E+01 |b - Ax|/(|A||x|) = 3.013701E-16
Yeah, I try it again. most examples can be run. There are some libraries without exist. Such as "JCudaDriver-11.1.1-windows-x86_64; JCudnn-11.1.1-windows-x86_64; "
Using 'UTF-8' encoding to copy filtered resources.
Copying 23 resources
--- maven-compiler-plugin:2.3.2:compile (default-compile) @ jcuda-samples ---
Nothing to compile - all classes are up to date
--- exec-maven-plugin:1.5.0:exec (default-cli) @ jcuda-samples ---
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error while loading native library "JCudaDriver-11.1.1-windows-x86_64"
Operating system name: Windows 10
Architecture : amd64
Architecture bit size: 64
---(start of nested stack traces)---
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: no JCudaDriver-11.1.1-windows-x86_64 in java.library.path: [E:\Program Files\Java\jdk-11.0.4\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\libnvvp, ., E:\Program Files (x86)\VMware\VMware Workstation\bin\, E:\Program Files\Tecplot\Tecplot Chorus 2019 R1\bin, E:\Program Files\Tecplot\Tecplot 360 EX 2019 R1\bin, C:\Program Files\Microsoft MPI\Bin\, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0\, C:\Windows\System32\OpenSSH\, C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common, E:\Program Files\Java\jdk-11.0.4\bin, E:\Program Files\graphviz\graphviz-2.38\release\bin, C:\Program Files\Microsoft SQL Server\130\Tools\Binn\, C:\Program Files\dotnet\, C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\, E:\Program Files\Git\cmd, E:\mysql\mysql-8.0.23-winx64\bin, E:\Program Files\nodejs\, E:\Program Files\nodejs, ., C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\WINDOWS\System32\OpenSSH\, C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.2.1\, C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR, E:\Users\winsw\AppData\Local\Programs\Python\Python37\Scripts\, E:\Users\winsw\AppData\Local\Programs\Python\Python37\, C:\Users\winsw\AppData\Local\Microsoft\WindowsApps, ., E:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\bin, ., E:\Microsoft VS Code\bin, E:\texlive\2020\bin\win32, D:\MyCode\JoyLibRelease/tool/bin, C:\Users\winsw\.dotnet\tools, C:\Users\winsw\AppData\Roaming\npm, .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
at java.base/java.lang.System.loadLibrary(System.java:1867)
at jcuda.LibUtils.loadLibrary(LibUtils.java:143)
at jcuda.driver.JCudaDriver.<clinit>(JCudaDriver.java:337)
at jcuda.driver.samples.JCudaVectorAdd.main(JCudaVectorAdd.java:50)
Stack trace from the attempt to load the library as a resource:
java.io.IOException: No resource found with name '/lib/JCudaDriver-11.1.1-windows-x86_64.dll'
at jcuda.LibUtils.writeResourceToFile(LibUtils.java:323)
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:255)
at jcuda.LibUtils.loadLibrary(LibUtils.java:158)
at jcuda.driver.JCudaDriver.<clinit>(JCudaDriver.java:337)
at jcuda.driver.samples.JCudaVectorAdd.main(JCudaVectorAdd.java:50)
---(end of nested stack traces)---
at jcuda.LibUtils.loadLibrary(LibUtils.java:193)
at jcuda.driver.JCudaDriver.<clinit>(JCudaDriver.java:337)
at jcuda.driver.samples.JCudaVectorAdd.main(JCudaVectorAdd.java:50)
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.320 s
Finished at: 2021-04-20T11:12:45+01:00
Final Memory: 8M/68M
------------------------------------------------------------------------
The JCudaDriver-11.1.1-windows-x86_64.dll
should be there (together with the Runtime
version).
But for JCudnn, you also need the cuDNN binaries (you can download them at https://developer.nvidia.com/cudnn If you are a registered developer)
The
JCudaDriver-11.1.1-windows-x86_64.dll
should be there (together with theRuntime
version).But for JCudnn, you also need the cuDNN binaries (you can download them at https://developer.nvidia.com/cudnn If you are a registered developer)
When I run the class JCudaConstantMemoryExample
, it can not work. this is not relate to JCudnn.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error while loading native library "JCudaDriver-11.1.1-windows-x86_64"
Operating system name: Windows 10
Architecture : amd64
Architecture bit size: 64
---(start of nested stack traces)---
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: no JCudaDriver-11.1.1-windows-x86_64 in java.library.path: [E:\Program Files\Java\jdk-11.0.4\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\libnvvp, ., E:\Program Files (x86)\VMware\VMware Workstation\bin\, E:\Program Files\Tecplot\Tecplot Chorus 2019 R1\bin, E:\Program Files\Tecplot\Tecplot 360 EX 2019 R1\bin, C:\Program Files\Microsoft MPI\Bin\, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0\, C:\Windows\System32\OpenSSH\, C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common, E:\Program Files\Java\jdk-11.0.4\bin, E:\Program Files\graphviz\graphviz-2.38\release\bin, C:\Program Files\Microsoft SQL Server\130\Tools\Binn\, C:\Program Files\dotnet\, C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\, E:\Program Files\Git\cmd, E:\mysql\mysql-8.0.23-winx64\bin, E:\Program Files\nodejs\, E:\Program Files\nodejs, ., C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\WINDOWS\System32\OpenSSH\, C:\Program Files\NVIDIA Corporation\Nsight Compute 2020.2.1\, C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR, E:\Users\winsw\AppData\Local\Programs\Python\Python37\Scripts\, E:\Users\winsw\AppData\Local\Programs\Python\Python37\, C:\Users\winsw\AppData\Local\Microsoft\WindowsApps, ., E:\Program Files\JetBrains\IntelliJ IDEA 2019.3.3\bin, ., E:\Microsoft VS Code\bin, E:\texlive\2020\bin\win32, D:\MyCode\JoyLibRelease/tool/bin, C:\Users\winsw\.dotnet\tools, C:\Users\winsw\AppData\Roaming\npm, .]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)
at java.base/java.lang.System.loadLibrary(System.java:1867)
at jcuda.LibUtils.loadLibrary(LibUtils.java:143)
at jcuda.driver.JCudaDriver.<clinit>(JCudaDriver.java:337)
at jcuda.driver.samples.JCudaConstantMemoryExample.main(JCudaConstantMemoryExample.java:39)
Stack trace from the attempt to load the library as a resource:
java.io.IOException: No resource found with name '/lib/JCudaDriver-11.1.1-windows-x86_64.dll'
The JCudaDriver-11.1.1-windows-x86_64.dll
and JCudaRuntime-11.1.1-windows-x86_64.dll
are located in the same JAR file. Are you sure that this is not the same error as the first one?
You could try the same procedure as in https://github.com/jcuda/jcuda-samples/issues/10#issuecomment-821852069 , but using
import jcuda.*;
import jcuda.driver.*;
public class JCudaDriverTest
{
public static void main(String args[])
{
JCudaDriver.init(0);
System.out.println("Done);
}
}
The
JCudaDriver-11.1.1-windows-x86_64.dll
andJCudaRuntime-11.1.1-windows-x86_64.dll
are located in the same JAR file. Are you sure that this is not the same error as the first one?You could try the same procedure as in #10 (comment) , but using
import jcuda.*; import jcuda.driver.*; public class JCudaDriverTest { public static void main(String args[]) { JCudaDriver.init(0); System.out.println("Done); } }
it appears this problem, i can not work.
I don't know the IDE that you are using there, and how it actually issues the Maven commands for building and running the application.
But to be sure:
- The
JCudaPrintDeviceInfo
sample does work, but theJCudaDriverTest
does not work, is that correct? - When you apply the process from https://github.com/jcuda/jcuda-samples/issues/10#issuecomment-821852069 with the
JCudaDriverTest
(instead ofJCudaRuntimeTest
), does it work or not?
I don't know the IDE that you are using there, and how it actually issues the Maven commands for building and running the application.
But to be sure:
- The
JCudaPrintDeviceInfo
sample does work, but theJCudaDriverTest
does not work, is that correct?- When you apply the process from #10 (comment) with the
JCudaDriverTest
(instead ofJCudaRuntimeTest
), does it work or not?
My IDE is Netbeans that a open source IDE. Now I have run the code.
I set the verison number is 11.1.1. Every class can not work besides package jcuda.driver.gl.samples
<groupId>org.jcuda</groupId>
<artifactId>jcuda-samples</artifactId>
<version>0.0.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jcuda.jcudaVersion>11.1.1</jcuda.jcudaVersion>
</properties>
<name>JCudaSamples</name>
<description>Samples for JCuda</description>
<url>http://www.jcuda.org</url>
Then I set verison number to 11.0.0.
-
jcuda.nvrtc.samples
package can not work -
jcuda.jcusolver.samples
package can not work -
jcuda.jcudnn.samples
package can not work -
jcuda.driver.samples
package ->JCudaVectorAdd
class can not work -
jcuda.driver.samples
package ->JCudaReduction
class can not work -
jcuda.driver.samples
package ->JCudaDynamicParallelism
class can not work -
jcuda.driver.samples
package ->JCudaDriverStreamCallbacks
class can not work -
jcuda.driver.samples
package ->JCudaDriverBasicGraphExample
class can not work -
jcuda.driver.samples
package ->JCudaConstantMemoryExample
class can not work.
You didn't answer the question of whether it works on the console. What you are saying about "works or doesn't work" (depending on the version and package) is pretty confusing for me right now. Either it works or it doesn't. But generally speaking: If JCuda does not work for you, try https://github.com/bytedeco/javacpp-presets/tree/master/cuda
Maybe you also overlooked the disclaimer in the README: Copy the sample that you want into your IDE, add the JCuda JARs as dependencies, and if there's a problem, then be specific about the problem.
Maybe you also overlooked the disclaimer in the README: Copy the sample that you want into your IDE, add the JCuda JARs as dependencies, and if there's a problem, then be specific about the problem.
Okay, Thanks for your help. Many thanks~