aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/demos/hellojocl/HelloJOCL.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2009-12-01 00:50:59 +0100
committerMichael Bien <[email protected]>2009-12-01 00:50:59 +0100
commitfa7b42cb1b3f9932a07666a8886ef276efb2ddf0 (patch)
tree79b053dd005af9173e4dd351651455c0113a5119 /src/com/mbien/opencl/demos/hellojocl/HelloJOCL.java
parent927ba4bbd684ad66da1da416562830af58d2cf57 (diff)
build is now ready to be used in hudson.
updated demos due to api changes.
Diffstat (limited to 'src/com/mbien/opencl/demos/hellojocl/HelloJOCL.java')
-rw-r--r--src/com/mbien/opencl/demos/hellojocl/HelloJOCL.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/com/mbien/opencl/demos/hellojocl/HelloJOCL.java b/src/com/mbien/opencl/demos/hellojocl/HelloJOCL.java
index aec01e2..e68acf3 100644
--- a/src/com/mbien/opencl/demos/hellojocl/HelloJOCL.java
+++ b/src/com/mbien/opencl/demos/hellojocl/HelloJOCL.java
@@ -10,7 +10,6 @@ import java.nio.FloatBuffer;
import java.util.Random;
import static java.lang.System.*;
-import static com.sun.gluegen.runtime.BufferFactory.*;
import static com.mbien.opencl.CLBuffer.Mem.*;
/**
@@ -23,7 +22,7 @@ import static com.mbien.opencl.CLBuffer.Mem.*;
public class HelloJOCL {
public static void main(String[] args) throws IOException {
-
+
int elementCount = 11444777; // Length of arrays to process
int localWorkSize = 256; // Local work size dimensions
int globalWorkSize = roundUp(localWorkSize, elementCount); // rounded up to the nearest multiple of the localWorkSize
@@ -58,7 +57,7 @@ public class HelloJOCL {
long time = nanoTime();
queue.putWriteBuffer(clBufferA, false)
.putWriteBuffer(clBufferB, false)
- .putNDRangeKernel(kernel, 1, 0, globalWorkSize, localWorkSize)
+ .put1DRangeKernel(kernel, 0, globalWorkSize, localWorkSize)
.putReadBuffer(clBufferC, true);
time = nanoTime() - time;
@@ -69,8 +68,8 @@ public class HelloJOCL {
out.println("a+b=c results snapshot: ");
for(int i = 0; i < 10; i++)
out.print(clBufferC.buffer.get() + ", ");
- out.println("...; " + clBufferC.buffer.remaining()/SIZEOF_FLOAT + " more");
-
+ out.println("...; " + clBufferC.buffer.remaining() + " more");
+
out.println("computation took: "+(time/1000000)+"ms");
}
@@ -91,4 +90,4 @@ public class HelloJOCL {
}
}
-}
+} \ No newline at end of file