Closed Raunak-Singh-Inventor closed 1 year ago
Raunak....
I looked at the Aparapi code here
Even though you have OpenCL 3.0 you should still see the message/warning
"Aparapi is running on an untested OpenCL platform version"
Have you built an OpenCL native program on this machine and had it actually execute?
Do you have experience compiling C++ code on Linux from cmake?
@grfrost I have experience compiling with cmake on Linux.
Can you please give me the instructions to install supported version of OpenCL?
You probably cannot get an earlier version.
But aparapi should work on yours.
You could pull the 3 maven repos and build yourself. That way we can add diagnostics in the native code to see what is going wrong.
Back top my earlier question. Have you built (and ran!) your own OpenCL C/Cpp code on this machine. I want to make sure all the shared libs are in place.
@grfrost No I have not ran my own OpenCL code. Do you have instructions where I can do that.
Also, what are the 3 maven repos you are asking me to build.
Thanks for your help.
Ok I just created a public github repo.
Can you clone this and build (cmake) and see if the build and runjava.sh script work for you?
https://github.com/grfrost/javacltest
On Tue, Jun 28, 2022 at 6:02 PM Raunak Singh @.***> wrote:
@grfrost https://github.com/grfrost No I have not ran my own OpenCL code. Do you have instructions where I can do that.
Also, what are the 3 maven repos you are asking me to build.
Thanks for your help.
— Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi/issues/168#issuecomment-1168993074, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBKEN4M2NDCPS7ICPHGKETVRMVZRANCNFSM5Z4VNVOQ . You are receiving this because you were mentioned.Message ID: @.***>
@grfrost Thanks for the repository link. I ran it and got this output from bash runjava.sh
:
There is 1 platform
platform 0{
CL_PLATFORM_VENDOR.."NVIDIA Corporation"
CL_PLATFORM_VERSION."OpenCL 3.0 CUDA 11.7.89"
CL_PLATFORM_NAME...."NVIDIA CUDA"
Platform 0 has 1 device{
Device 0{
CL_DEVICE_TYPE..................... GPU (0x0)
CL_DEVICE_MAX_COMPUTE_UNITS........ 48
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS. 3
dim[0] = 1024
dim[1] = 1024
dim[2] = 64
CL_DEVICE_MAX_WORK_GROUP_SIZE...... 1024
CL_DEVICE_MAX_MEM_ALLOC_SIZE....... 4227088384
CL_DEVICE_GLOBAL_MEM_SIZE.......... 16908353536
CL_DEVICE_LOCAL_MEM_SIZE........... 49152
CL_DEVICE_PROFILE.................. FULL_PROFILE
CL_DEVICE_VERSION.................. OpenCL 3.0 CUDA
CL_DRIVER_VERSION.................. 515.48.07
CL_DEVICE_OPENCL_C_VERSION......... OpenCL C 1.2
CL_DEVICE_NAME..................... NVIDIA GeForce RTX 3080 Laptop GPU
CL_DEVICE_EXTENSIONS............... cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_device_uuid cl_khr_pci_bus_info cl_khr_external_semaphore cl_khr_external_memory cl_khr_external_semaphore_opaque_fd cl_khr_external_memory_opaque_fd
CL_DEVICE_BUILT_IN_KERNELS.........
}
}
}
OK so java can call jni and opencl on this machine, Aparapi should run just fine.
I suspect that the issue is that for some reason on this platform the OpenCL shared lib is not on the default path/LD_LIBRARY_PATH
We need to find libOpenCL and either add it to LD_LIBRARY_PATH or tell java where this library is when we run Aparapi.
So first lets find your libOpenCL.so
We will use linux ldd command to query the dynamic libraries loaded by your clinfo tool and note the directory where libOpenCL.so is
$ ldd /usr/bin/clinfo linux-vdso.so.1 (0x00007ffd439b4000) libOpenCL.so.1 => /opt/rocm/lib/libOpenCL.so.1 (0x00007f504df13000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f504def2000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f504dd00000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f504dcdd000) /lib64/ld-linux-x86-64.so.2 (0x00007f504e139000)
So my libOpenCL.so (mine is from AMD) is in /opt/rocm/lib
Once you have located libOpenCL you need to add that dir to to your java command line using -Djava.library.path=/opt/rocm/lib (or whetever your path is)
$ java -Djava.library.path=/opt/rocm/lib ... other Aparapi options
Does that make sense?
On Thu, Jun 30, 2022 at 10:03 PM Raunak Singh @.***> wrote:
@grfrost https://github.com/grfrost Thanks for the repository link. I ran it and got this output from bash runjava.sh:
There is 1 platform platform 0{ CL_PLATFORM_VENDOR.."NVIDIA Corporation" CL_PLATFORM_VERSION."OpenCL 3.0 CUDA 11.7.89" CL_PLATFORM_NAME...."NVIDIA CUDA" Platform 0 has 1 device{ Device 0{ CL_DEVICE_TYPE..................... GPU (0x0) CL_DEVICE_MAX_COMPUTE_UNITS........ 48 CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS. 3 dim[0] = 1024 dim[1] = 1024 dim[2] = 64 CL_DEVICE_MAX_WORK_GROUP_SIZE...... 1024 CL_DEVICE_MAX_MEM_ALLOC_SIZE....... 4227088384 CL_DEVICE_GLOBAL_MEM_SIZE.......... 16908353536 CL_DEVICE_LOCAL_MEM_SIZE........... 49152 CL_DEVICE_PROFILE.................. FULL_PROFILE CL_DEVICE_VERSION.................. OpenCL 3.0 CUDA CL_DRIVER_VERSION.................. 515.48.07 CL_DEVICE_OPENCL_C_VERSION......... OpenCL C 1.2 CL_DEVICE_NAME..................... NVIDIA GeForce RTX 3080 Laptop GPU CL_DEVICE_EXTENSIONS............... cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_nv_create_buffer cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_device_uuid cl_khr_pci_bus_info cl_khr_external_semaphore cl_khr_external_memory cl_khr_external_semaphore_opaque_fd cl_khr_external_memory_opaque_fd CL_DEVICE_BUILT_IN_KERNELS......... } } }
— Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi/issues/168#issuecomment-1171674361, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBKEN5ECBZPSTTBJTGHHQLVRYDTRANCNFSM5Z4VNVOQ . You are receiving this because you were mentioned.Message ID: @.***>
here is the output
(base) rauna@pop-os:~$ ldd /usr/bin/clinfo linux-vdso.so.1 (0x00007ffd9fbce000) libOpenCL.so.1 => /usr/local/cuda-11.7/lib64/libOpenCL.so.1 (0x00007fe000600000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe0008f0000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe0003d8000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe0008eb000) /lib64/ld-linux-x86-64.so.2 (0x00007fe000939000)
@grfrost after passing the command line argument I am stil getting the same error:
/home/rauna/.jdks/openjdk-18.0.1.1/bin/java -javaagent:/home/rauna/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5921.22/lib/idea_rt.jar=42963:/home/rauna/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5921.22/bin -Dfile.encoding=UTF-8 -classpath /home/rauna/Documents/cudaProgramming/target/classes:/home/rauna/.m2/repository/com/aparapi/aparapi/2.0.0/aparapi-2.0.0.jar:/home/rauna/.m2/repository/com/aparapi/aparapi-jni/1.4.2/aparapi-jni-1.4.2.jar:/home/rauna/.m2/repository/org/apache/bcel/bcel/6.4.1/bcel-6.4.1.jar:/home/rauna/.m2/repository/org/scala-lang/scala-library/2.13.1/scala-library-2.13.1.jar cudaProgramming.parallel.CudaSquare -Djava.library.path=/usr/local/cuda-11.7/lib64/
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.aparapi.device.Device.createRange(int)" because "device" is null
at cudaProgramming.parallel.CudaSquare.main(CudaSquare.java:62)
Process finished with exit code 1
I replied to your email with pictures. ;) in case you don't get that.
I think you added -Djava.library.path=...... AFTER your class name
-Dxxxxx options are intended for the JVM not params to your code
So they appear before the class you are using
You have /home/rauna/.jdks/openjdk-18.0.1.1/bin/java ...../scala-library-2.13.1.jar cudaProgramming.parallel.CudaSquare -Djava.library.path=/usr/local/cuda-11.7/lib64/
You want /home/rauna/.jdks/openjdk-18.0.1.1/bin/java ...../scala-library-2.13.1.jar -Djava.library.path=/usr/local/cuda-11.7/lib64/ cudaProgramming.parallel.CudaSquare
In intellij don't add -Dxxxx as a program argument add it as a jvmoption
So in run config
image.png
Click on modify options and then vmoptions
image.png
Then in the new 'VM Options' text field
image.png Add -Djava.library.path=/usr/local/cuda-11.7/lib64/ image.png
That should do it ;). hopefully
@grfrost now I added the java argument to the JVM as you said but I am stil getting the same error. please assist:
/home/rauna/.jdks/openjdk-18.0.1.1/bin/java -Djava.library.path=/usr/local/cuda-11.7/lib64/ -javaagent:/home/rauna/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5921.22/lib/idea_rt.jar=43091:/home/rauna/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5921.22/bin -Dfile.encoding=UTF-8 -classpath /home/rauna/Documents/cudaProgramming/target/classes:/home/rauna/.m2/repository/com/aparapi/aparapi/2.0.0/aparapi-2.0.0.jar:/home/rauna/.m2/repository/com/aparapi/aparapi-jni/1.4.2/aparapi-jni-1.4.2.jar:/home/rauna/.m2/repository/org/apache/bcel/bcel/6.4.1/bcel-6.4.1.jar:/home/rauna/.m2/repository/org/scala-lang/scala-library/2.13.1/scala-library-2.13.1.jar cudaProgramming.parallel.CudaSquare
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.aparapi.device.Device.createRange(int)" because "device" is null
at cudaProgramming.parallel.CudaSquare.main(CudaSquare.java:62)
Note: I can't see the images on my end. I just see text of image.png
OK I don't run using intellij.
Two things to try. 1) Try getting rid of the intellij stuff from the above command line and launch from the command line
/home/rauna/.jdks/openjdk-18.0.1.1/bin/java -Djava.library.path=/usr/local/cuda-11.7/lib64/ -classpath /home/rauna/Documents/cudaProgramming/target/classes:/home/rauna/.m2/repository/com/aparapi/aparapi/2.0.0/aparapi-2.0.0.jar:/home/rauna/.m2/repository/com/aparapi/aparapi-jni/1.4.2/aparapi-jni-1.4.2.jar:/home/rauna/.m2/repository/org/apache/bcel/bcel/6.4.1/bcel-6.4.1.jar:/home/rauna/.m2/repository/org/scala-lang/scala-library/2.13.1/scala-library-2.13.1.jar cudaProgramming.parallel.CudaSquare
2) set LD_LIBRARY_PATH (intellij probably has a way to set an environment variable at launch).
LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64/ /home/rauna/.jdks/openjdk-18.0.1.1/bin/java -Djava.library.path=/usr/local/cuda-11.7/lib64/ -classpath /home/rauna/Documents/cudaProgramming/target/classes:/home/rauna/.m2/ repository/com/aparapi/aparapi/2.0.0/aparapi-2.0.0.jar:/home/rauna/.m2/ repository/com/aparapi/aparapi-jni/1.4.2/aparapi-jni- 1.4.2.jar:/home/rauna/.m2/repository/org/apache/bcel/ bcel/6.4.1/bcel-6.4.1.jar:/home/rauna/.m2/repository/org/ scala-lang/scala-library/2.13.1/scala-library-2.13.1.jar cudaProgramming.parallel.CudaSquare I left the Scala stuff, but worry a bit about why it is there?
Gary
On Mon, Jul 4, 2022 at 3:24 PM Raunak Singh @.***> wrote:
@grfrost https://github.com/grfrost now I added the java argument to the JVM as you said but I am stil getting the same error. please assist:
/home/rauna/.jdks/openjdk-18.0.1.1/bin/java -Djava.library.path=/usr/local/cuda-11.7/lib64/ -javaagent:/home/rauna/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5921.22/lib/idea_rt.jar=43091:/home/rauna/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5921.22/bin -Dfile.encoding=UTF-8 -classpath /home/rauna/Documents/cudaProgramming/target/classes:/home/rauna/.m2/repository/com/aparapi/aparapi/2.0.0/aparapi-2.0.0.jar:/home/rauna/.m2/repository/com/aparapi/aparapi-jni/1.4.2/aparapi-jni-1.4.2.jar:/home/rauna/.m2/repository/org/apache/bcel/bcel/6.4.1/bcel-6.4.1.jar:/home/rauna/.m2/repository/org/scala-lang/scala-library/2.13.1/scala-library-2.13.1.jar cudaProgramming.parallel.CudaSquare Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.aparapi.device.Device.createRange(int)" because "device" is null at cudaProgramming.parallel.CudaSquare.main(CudaSquare.java:62)
Note: I can't see the images on my end. I just see text of image.png
— Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi/issues/168#issuecomment-1173880115, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBKEN7NBT2T4U46UJRNZQDVSLXYDANCNFSM5Z4VNVOQ . You are receiving this because you were mentioned.Message ID: @.***>
Suggestion 1) Please give me clear starightforward instructions as I don't have that much experience compiling in Maven from command line. I rely heavily on IntelliJ
Suggestion 2) didn't work even though I set the env path here:
I have done a lot of work to try to help you.
Please read the msg i put on the aparapi gitlab page
@mandeepsingh-private you might be able to rebuild and test using
https://github.com/grfrost/aparapi- https://github.com/grfrost/aparapi-m1 builder-cmake
Build and run works for me on Apple M1 and linux x64 platforms. So hopefully it will find you NVidia CUDA OpenCL lib....
I don't generally use intellij
I have never used nvidia cards
You are going to need to be able to use the command line to debug this...
So now is your chance to learn
On Wed, Jul 6, 2022 at 2:36 AM Raunak Singh @.***> wrote:
Suggestion 1) Please give me clear starightforward instructions as I don't have that much experience compiling in Maven from command line. I rely heavily on IntelliJ
Suggestion 2) didn't work even though I set the env path here: [image: image] https://user-images.githubusercontent.com/46200816/177446684-23491aca-8035-4aee-acb5-e5356b6c2e83.png
— Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi/issues/168#issuecomment-1175679406, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBKEN7SMLP7ONV4FY2KE6TVSTPJXANCNFSM5Z4VNVOQ . You are receiving this because you were mentioned.Message ID: @.***>
@grfrost I tried using CUDA C++ and it is working for me. Thanks for all of your help, I will look at this again at a later date when I'm a little more experienced :)
Excellent, cuda has some great tool support. It is a great way to learn the fundamentals
Gary
On Fri, 15 Jul 2022 at 21:07, Raunak Singh @.***> wrote:
@grfrost https://github.com/grfrost I tried using CUDA C++ and it is working for me. Thanks for all of your help, I will look at this again at a later date when I'm a little more experienced :)
— Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi/issues/168#issuecomment-1185872954, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBKENYR7QUISVLM352EESLVUHAJZANCNFSM5Z4VNVOQ . You are receiving this because you were mentioned.Message ID: @.***>
My bad ;)
-Dxxxxx options are intended for the JVM not params to your code
So they appear before the class you are using
You have /home/rauna/.jdks/openjdk-18.0.1.1/bin/java ...../scala-library-2.13.1.jar cudaProgramming.parallel.CudaSquare -Djava.library.path=/usr/local/cuda-11.7/lib64/
You want /home/rauna/.jdks/openjdk-18.0.1.1/bin/java ...../scala-library-2.13.1.jar -Djava.library.path=/usr/local/cuda-11.7/lib64/ cudaProgramming.parallel.CudaSquare
In intellij don't add -Dxxxx as a program argument add it as a jvmoption So in run config [image: image.png] Click on modify options and then vmoptions
[image: image.png]
Then in the new 'VM Options' text field
[image: image.png] Add -Djava.library.path=/usr/local/cuda-11.7/lib64/ [image: image.png]
That should do it ;). hopefully
On Mon, Jul 4, 2022 at 12:28 PM Raunak Singh @.***> wrote:
@grfrost https://github.com/grfrost after passing the command line argument I am stil getting the same error:
/home/rauna/.jdks/openjdk-18.0.1.1/bin/java -javaagent:/home/rauna/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5921.22/lib/idea_rt.jar=42963:/home/rauna/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/221.5921.22/bin -Dfile.encoding=UTF-8 -classpath /home/rauna/Documents/cudaProgramming/target/classes:/home/rauna/.m2/repository/com/aparapi/aparapi/2.0.0/aparapi-2.0.0.jar:/home/rauna/.m2/repository/com/aparapi/aparapi-jni/1.4.2/aparapi-jni-1.4.2.jar:/home/rauna/.m2/repository/org/apache/bcel/bcel/6.4.1/bcel-6.4.1.jar:/home/rauna/.m2/repository/org/scala-lang/scala-library/2.13.1/scala-library-2.13.1.jar cudaProgramming.parallel.CudaSquare -Djava.library.path=/usr/local/cuda-11.7/lib64/ Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.aparapi.device.Device.createRange(int)" because "device" is null at cudaProgramming.parallel.CudaSquare.main(CudaSquare.java:62)
Process finished with exit code 1
— Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi/issues/168#issuecomment-1173706313, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBKEN2JFYTO5DOVXOCZTZ3VSLDF7ANCNFSM5Z4VNVOQ . You are receiving this because you were mentioned.Message ID: @.***>
I found myself with the same problem on windows with an RTX 3060.
The website says that "It is no longer required to manually install the Aparapi JNI native interface, this is now done automatically through maven as a dependency on Aparapi."
I thought that meant this was the only needed dependency:
<dependency>
<groupId>com.aparapi</groupId>
<artifactId>aparapi</artifactId>
<version>2.0.0</version>
</dependency>
However I also needed the dependency on aparapi-jni:
<dependency>
<groupId>com.aparapi</groupId>
<artifactId>aparapi-jni</artifactId>
<version>1.4.3</version>
</dependency>
which fixed everything. just in case someone has a similar issue..
Hi,
Aparapi is not detecting my gpu even though I have OpenCL installed. When I run these two lines:
It gives me null pointer exception which proves that GPU is not detected.
GPU: Nvidia RTX 3080 OpenCL version: 3.0 Operating System: Pop OS (Ubuntu)
CudaSquare.java
:Output of
/usr/bin/clinfo
: