CUDA in Processing working!
in
Library and Tool Development
•
2 years ago
Hello all,
I got CUDA working in Processing, i used the JCuda libraries they can be found at www.JCUDA.org. To get the JCuda libraries to get to work, you need to download a few things, but more about this later.
The results: Depending on the size of the array you want to alter by CUDA, CUDA can be lightning fast.
For example: I made a program that sort an array with a size depending on the screen size. The screensize is resizable, Java sort is in it and CUDA sort.
Java sort is faster than CUDA if the array is 100.000 records or less. With 250.000 records, CUDA is twice as fast. With 1.600.000 records, CUDA is 3 times faster than Java.
Wrong! I found out that Java sort is faster when it only needs to sort till 255. When 2,147,483,647 is used, CUDA is overall 3 times faster than Java Sort and, CUDA is ten times faster when 1.600.000 numbers needs to be sorted. I will update the source soon.
So far, there are no problems running CUDA in Processing, except when i compile it to an executable or an applet, it ain't working. I am not sure if it's my machine that cause the problem or the DLL's. I am still working on that.
So far i have:
- device detection test with all the information about it (still working on this one, i get a bug with the detection while it still shows all information about it);
- sort test, sorting one array with a large amount of random integer numbers;
- SGEMM test, the formula is C = alpha * A * B + beta * C. Single-precision floating point values alpha and beta and matrices A, B and C of size 500x500. I am still looking for a good example code to make it visual. Help needed!
Installation:
- You need a CUDA-enabled GPU device;
- JCUDA libraries ( http://www.jcuda.org/downloads/downloads.html)
- JCUDA documentation ( http://www.jcuda.org/downloads/JCuda-All-0.3.2-doc.zip)
- the NVIDIA driver with CUDA support ( http://developer.nvidia.com/object/cuda_3_2_downloads.html)
- the CUDA Toolkit ( http://developer.nvidia.com/object/cuda_3_2_downloads.html)
- the CUDA SDK ( http://developer.nvidia.com/object/cuda_3_2_downloads.html)
The JCUDA libraries needs to be placed in :
C:/<user>/Documents/Processing/libraries/jcuda/library
Rename all the JAR files so that only a name is visible. You have to remove the version numbers and the minus char. For example, "jcuda.jar"
The JCUDA documention needs to be extracted to :
"C:/<user>/Documents/Processing/libraries/jcuda/documentation"
Install the NVIDIA driver with CUDA support;
Install the CUDA Toolkit;
Goto the folder "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v3.2/bin"
Copy all .dll files to " C:/<user>/Documents/Processing/libraries/jcuda/library"
Install the CUDA SDK and goto the folder
"C:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 3.2/C/common/bin"
Copy cudpp64_32_16.dll (or cudpp32_32_16.dll) to " C:/<user>/Documents/Processing/libraries/jcuda/library"
Now you have JCuda working in Processing!
Greetings, Dippo
I got CUDA working in Processing, i used the JCuda libraries they can be found at www.JCUDA.org. To get the JCuda libraries to get to work, you need to download a few things, but more about this later.
The results: Depending on the size of the array you want to alter by CUDA, CUDA can be lightning fast.
For example: I made a program that sort an array with a size depending on the screen size. The screensize is resizable, Java sort is in it and CUDA sort.
Java sort is faster than CUDA if the array is 100.000 records or less. With 250.000 records, CUDA is twice as fast. With 1.600.000 records, CUDA is 3 times faster than Java.
Wrong! I found out that Java sort is faster when it only needs to sort till 255. When 2,147,483,647 is used, CUDA is overall 3 times faster than Java Sort and, CUDA is ten times faster when 1.600.000 numbers needs to be sorted. I will update the source soon.
So far, there are no problems running CUDA in Processing, except when i compile it to an executable or an applet, it ain't working. I am not sure if it's my machine that cause the problem or the DLL's. I am still working on that.
So far i have:
- device detection test with all the information about it (still working on this one, i get a bug with the detection while it still shows all information about it);
- sort test, sorting one array with a large amount of random integer numbers;
- SGEMM test, the formula is C = alpha * A * B + beta * C. Single-precision floating point values alpha and beta and matrices A, B and C of size 500x500. I am still looking for a good example code to make it visual. Help needed!
Installation:
- You need a CUDA-enabled GPU device;
- JCUDA libraries ( http://www.jcuda.org/downloads/downloads.html)
- JCUDA documentation ( http://www.jcuda.org/downloads/JCuda-All-0.3.2-doc.zip)
- the NVIDIA driver with CUDA support ( http://developer.nvidia.com/object/cuda_3_2_downloads.html)
- the CUDA Toolkit ( http://developer.nvidia.com/object/cuda_3_2_downloads.html)
- the CUDA SDK ( http://developer.nvidia.com/object/cuda_3_2_downloads.html)
The JCUDA libraries needs to be placed in :
C:/<user>/Documents/Processing/libraries/jcuda/library
Rename all the JAR files so that only a name is visible. You have to remove the version numbers and the minus char. For example, "jcuda.jar"
The JCUDA documention needs to be extracted to :
"C:/<user>/Documents/Processing/libraries/jcuda/documentation"
Install the NVIDIA driver with CUDA support;
Install the CUDA Toolkit;
Goto the folder "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v3.2/bin"
Copy all .dll files to " C:/<user>/Documents/Processing/libraries/jcuda/library"
Install the CUDA SDK and goto the folder
"C:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 3.2/C/common/bin"
Copy cudpp64_32_16.dll (or cudpp32_32_16.dll) to " C:/<user>/Documents/Processing/libraries/jcuda/library"
Now you have JCuda working in Processing!
Greetings, Dippo
1