diff options
Diffstat (limited to 'test/com/jogamp')
-rw-r--r-- | test/com/jogamp/opencl/CLCommandQueueTest.java | 7 | ||||
-rw-r--r-- | test/com/jogamp/opencl/HighLevelBindingTest.java | 3 | ||||
-rw-r--r-- | test/com/jogamp/opencl/LowLevelBindingTest.java | 2 | ||||
-rw-r--r-- | test/com/jogamp/opencl/TestUtils.java | 9 |
4 files changed, 7 insertions, 14 deletions
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java index f5438d40..7efc3aa0 100644 --- a/test/com/jogamp/opencl/CLCommandQueueTest.java +++ b/test/com/jogamp/opencl/CLCommandQueueTest.java @@ -51,6 +51,7 @@ import static com.jogamp.opencl.TestUtils.*; import static com.jogamp.opencl.CLEvent.*; import static com.jogamp.opencl.CLVersion.*; import static com.jogamp.common.nio.Buffers.*; +import static com.jogamp.opencl.util.CLUtil.*; import static com.jogamp.opencl.CLCommandQueue.Mode.*; /** @@ -102,7 +103,7 @@ public class CLCommandQueueTest { CLDevice device = context.getDevices()[0]; int groupSize = device.getMaxWorkItemSizes()[0]; - final int elements = roundUp(groupSize, ONE_MB / SIZEOF_INT * 5); // 5MB per buffer + final int elements = roundUp(ONE_MB / SIZEOF_INT * 5, groupSize); // 5MB per buffer CLBuffer<ByteBuffer> clBufferA = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY); CLBuffer<ByteBuffer> clBufferB = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY); @@ -232,7 +233,7 @@ public class CLCommandQueueTest { CLDevice device = context.getDevices()[0]; int groupSize = device.getMaxWorkItemSizes()[0]; - final int elements = roundUp(groupSize, ONE_MB / SIZEOF_INT * 5); // 5MB per buffer + final int elements = roundUp(ONE_MB / SIZEOF_INT * 5, groupSize); // 5MB per buffer CLBuffer<ByteBuffer> clBufferA = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY); CLBuffer<ByteBuffer> clBufferB = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY); @@ -301,7 +302,7 @@ public class CLCommandQueueTest { CLDevice device = context.getDevices()[0]; int groupSize = device.getMaxWorkItemSizes()[0]; - final int elements = roundUp(groupSize, ONE_MB / SIZEOF_INT * 5); // 5MB per buffer + final int elements = roundUp(ONE_MB / SIZEOF_INT * 5, groupSize); // 5MB per buffer CLBuffer<ByteBuffer> clBufferA = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY); CLBuffer<ByteBuffer> clBufferB = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY); diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java index 449ccd7b..db1a9333 100644 --- a/test/com/jogamp/opencl/HighLevelBindingTest.java +++ b/test/com/jogamp/opencl/HighLevelBindingTest.java @@ -58,6 +58,7 @@ import static com.jogamp.opencl.util.CLPlatformFilters.*; import static com.jogamp.opencl.CLVersion.*; import static com.jogamp.opencl.CLDevice.Type.*; import static com.jogamp.common.nio.Buffers.*; +import static com.jogamp.opencl.util.CLUtil.*; /** * Test testing the high level bindings. @@ -376,7 +377,7 @@ public class HighLevelBindingTest { int elementCount = 11444777; // Length of float arrays to process (odd # for illustration) int localWorkSize = device.getMaxWorkItemSizes()[0]; // set and log Global and Local work size dimensions - int globalWorkSize = roundUp(localWorkSize, elementCount); // rounded up to the nearest multiple of the LocalWorkSize + int globalWorkSize = roundUp(elementCount, localWorkSize); // rounded up to the nearest multiple of the LocalWorkSize out.println("allocateing buffers of size: "+globalWorkSize); diff --git a/test/com/jogamp/opencl/LowLevelBindingTest.java b/test/com/jogamp/opencl/LowLevelBindingTest.java index 655bfc64..2c54a5ad 100644 --- a/test/com/jogamp/opencl/LowLevelBindingTest.java +++ b/test/com/jogamp/opencl/LowLevelBindingTest.java @@ -267,7 +267,7 @@ public class LowLevelBindingTest { checkError("on clCreateCommandQueue", intBuffer.get(0)); int localWorkSize = Math.min(128, maxWGS); // set and log Global and Local work size dimensions - int globalWorkSize = roundUp(localWorkSize, ELEMENT_COUNT); // rounded up to the nearest multiple of the LocalWorkSize + int globalWorkSize = roundUp(ELEMENT_COUNT, localWorkSize); // rounded up to the nearest multiple of the LocalWorkSize out.println("allocateing buffers of size: "+globalWorkSize); diff --git a/test/com/jogamp/opencl/TestUtils.java b/test/com/jogamp/opencl/TestUtils.java index efe6855e..e7e5fabe 100644 --- a/test/com/jogamp/opencl/TestUtils.java +++ b/test/com/jogamp/opencl/TestUtils.java @@ -69,15 +69,6 @@ public class TestUtils { return buffer; } - public static int roundUp(int groupSize, int globalSize) { - int r = globalSize % groupSize; - if (r == 0) { - return globalSize; - } else { - return globalSize + groupSize - r; - } - } - public static void checkIfEqual(ByteBuffer a, ByteBuffer b, int elements) { for(int i = 0; i < elements; i++) { int aVal = a.getInt(); |