JCuda in Processing, drawing example
in
Library and Tool Development
•
6 months ago
Following in
Dippo's footsteps, I have been trying to use JCuda within Processing. With success. :]
What it does: Uses a compiled GPU kernel to generate a wave centered on the mouse, propagating outward.
Setup:
Follow these links, download and install for your machine (assuming you have a CUDA capable graphics card):
(mostly from Dippo's post)
Copy DLL files from:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v5.0/bin
The JCUDA libraries needs to be placed in :C:/<user>/Documents/Processing/libraries/jcuda/libraryRename 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 CUDA Toolkit;
Almost identical with the exception of cudpp64_32_16.dll and cudpp32_32_16.dll's. I couldn't find them on my machine. There is an npp32(64?)_50_35.dll as well as cublas32_50_35.dll; perhaps NVIDIA has another way of handling newer libraries.
Known quirks: On exit, the debug window reports "jcuda.CudaException: CUDA_ERROR_INVALID_CONTEXT" after attempting to free RAM on the graphics card. Still works on the next run... I don't know if this will cause trouble with other software.
Code to follow
Save the cuda portion of code as a *.cu file in data folder of sketch.
-Noah
My system:
Windows XP pro, SP3
AMD Athlon 64 X2 Dual core, 2.27GHz
3GB (usable by Windows) RAM
NVIDIA GeForce GT 430