I accidently deleted my original post when i wanted to reply on my own post. :(
So, here is my question again. :)
I want to integrate Beanshell in a sketch, except i have load of problems to get it done. I tried the links on the Wiki and most of them don't work anymore. I got only one example working, Except the wrapper (of the working version) gives a constant error, also it ain't working 100%.
I found out that Beanshell is also integrated in jEdit, so i would hit 2 flies at once, a) a updated Beanshell option and b) an editor. But i found out that Processing does not like jEdit because Processing ignores the jEdit jar file. I found the (updated) source files of Beanshell in the JEdit source! I tried to compile the Beanshell souce inside of Processing, but my PDE does not like so many files at once (tabs problem). So i am getting out of options. I think that Beanshell is a good option because it's Java all the way and it's fast too.
I made a program to fill the screen with random pixels. Except, when i run this program over and over again, i get the same result everytime. I can not see where it goes wrong. Thanks for helping.
void setup() {
size(1000,1000,JAVA2D);
}
void draw() {
Random random = new Random();
float x[] = new float[1000];
for (int i = 0; i < 1000; i++) x[i] = random.nextFloat()*1000;
Random random2 = new Random();
float y[] = new float[1000];
for (int i = 0; i < 1000; i++) y[i] = random2.nextFloat()*1000;
loadPixels();
for (int i=0;i<1000;i++) pixels[(int)x[i]*(int)y[i]]=color(255,255,255);
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!
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"
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"