summaryrefslogtreecommitdiffstats
path: root/test/com/mbien/opencl/TestUtils.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2009-10-20 22:06:10 +0200
committerMichael Bien <[email protected]>2009-10-20 22:06:10 +0200
commitabe0135b4457d4c4ff722b0f39a47cad6c178f7e (patch)
treecba794c54c5cc0f9d005b8ab2d7781f739c01d07 /test/com/mbien/opencl/TestUtils.java
parent7f2db980b303fa75f3830679ce65fe4ae41c30dc (diff)
refactored JOCLTest into LowLevelBindingTest and HighLevelBindingTest.
moved listCLPlatforms() and getLowLevelBinding() from CLContext to CLPlatform. added method to create CLPrograms from InputStreams and updated test.
Diffstat (limited to 'test/com/mbien/opencl/TestUtils.java')
-rw-r--r--test/com/mbien/opencl/TestUtils.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/com/mbien/opencl/TestUtils.java b/test/com/mbien/opencl/TestUtils.java
new file mode 100644
index 00000000..70bade8a
--- /dev/null
+++ b/test/com/mbien/opencl/TestUtils.java
@@ -0,0 +1,29 @@
+package com.mbien.opencl;
+
+import java.nio.ByteBuffer;
+import java.util.Random;
+
+/**
+ * @author Michael Bien
+ */
+public class TestUtils {
+
+ public static final void fillBuffer(ByteBuffer buffer, int seed) {
+
+ Random rnd = new Random(seed);
+
+ while(buffer.remaining() != 0)
+ buffer.putInt(rnd.nextInt());
+
+ buffer.rewind();
+ }
+
+ public static final int roundUp(int groupSize, int globalSize) {
+ int r = globalSize % groupSize;
+ if (r == 0) {
+ return globalSize;
+ } else {
+ return globalSize + groupSize - r;
+ }
+ }
+}