Hi Marco, thanks for the assistance! I did see „64-Bit Server VM“ in the description when I typed java -version, but after checking, I discovered that there were multiple versions of Java installed on this computer (including a 32 bit one). After cleaning those up, I was able to get the tutorial code to execute.
To address your short aside: my original goal was to incorporate JCuda into an existing project that uses gradle, but after running into the previous issue, I started a new project to resolve it in a vacuum. Once I confirmed that it was the Java version that was the issue, I cloned the jcuda-example-maven project you linked as an intermediate step (it was very helpful, thank you!). I was almost able to run that out of the box after updating the version to 10.1.0. However, this line causes the exception included below (commenting it out resulted in success).
JCusparse.setExceptionsEnabled(true);
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error while loading native library "JCusparse-10.1.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-10.1.0-windows-x86_64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at jcuda.LibUtils.loadLibrary(LibUtils.java:143)
at jcuda.jcusparse.JCusparse.initialize(JCusparse.java:77)
at jcuda.jcusparse.JCusparse.<clinit>(JCusparse.java:62)
at org.jcuda.example.maven.JCudaExampleMaven.main(JCudaExampleMaven.java:25)
Stack trace from the attempt to load the library as a resource:
java.lang.UnsatisfiedLinkError: C:\Users\lklein\AppData\Local\Temp\JCusparse-10.1.0-windows-x86_64.dll: The specified procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:260)
at jcuda.LibUtils.loadLibrary(LibUtils.java:158)
at jcuda.jcusparse.JCusparse.initialize(JCusparse.java:77)
at jcuda.jcusparse.JCusparse.<clinit>(JCusparse.java:62)
at org.jcuda.example.maven.JCudaExampleMaven.main(JCudaExampleMaven.java:25)
---(end of nested stack traces)---
at jcuda.LibUtils.loadLibrary(LibUtils.java:193)
at jcuda.jcusparse.JCusparse.initialize(JCusparse.java:77)
at jcuda.jcusparse.JCusparse.<clinit>(JCusparse.java:62)
at org.jcuda.example.maven.JCudaExampleMaven.main(JCudaExampleMaven.java:25)
I don’t believe I need jcusparse for what I’m working on, but wanted to mention in case it was useful for you, since it was only that one.
Finally, I translated the maven dependencies to the gradle format and included them in my actual project. I ended up getting project resolve errors, where ${jcuda.os} and ${jcuda.arch} were being used as is, without having their values substituted. I searched around some and found this link: https://github.com/jcuda/jcuda-main/issues/16. I used the provided gradle code to resolve the issue. Since it’s been a few years since that thread, I was wondering whether there’s a more concise solution available that I’ve missed?
Either way, thank you again for your help!