summaryrefslogtreecommitdiffstats
path: root/test/com/mbien/opencl/HighLevelBindingTest.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-01-13 00:16:50 +0100
committerMichael Bien <[email protected]>2010-01-13 00:16:50 +0100
commit9343c3ef5829f74207a8d220cb3b082211b910f2 (patch)
treece01d1a4a0dfbbbdf763fa3b6883e525a47e0e74 /test/com/mbien/opencl/HighLevelBindingTest.java
parent4aebe5715b7d61591c8e0b677e452b3905e5ecd6 (diff)
refactored HighLevelBindingTest into seperate tests.
added CLConcurrencyTest and fixed some bugs in CLEvent codepaths.
Diffstat (limited to 'test/com/mbien/opencl/HighLevelBindingTest.java')
-rw-r--r--test/com/mbien/opencl/HighLevelBindingTest.java91
1 files changed, 0 insertions, 91 deletions
diff --git a/test/com/mbien/opencl/HighLevelBindingTest.java b/test/com/mbien/opencl/HighLevelBindingTest.java
index da1080d1..cf19c5b1 100644
--- a/test/com/mbien/opencl/HighLevelBindingTest.java
+++ b/test/com/mbien/opencl/HighLevelBindingTest.java
@@ -3,7 +3,6 @@ package com.mbien.opencl;
import com.mbien.opencl.CLBuffer.Mem;
import com.mbien.opencl.CLCommandQueue.Mode;
import com.mbien.opencl.CLDevice.SingleFPConfig;
-import com.sun.opengl.util.BufferUtil;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.EnumSet;
@@ -22,9 +21,6 @@ import static com.sun.gluegen.runtime.BufferFactory.*;
*/
public class HighLevelBindingTest {
- //decrease this value on systems with few memory.
- private final static int NUM_ELEMENTS = 10000000;
-
@BeforeClass
public static void setUpClass() throws Exception {
out.println("OS: " + System.getProperty("os.name"));
@@ -187,79 +183,6 @@ public class HighLevelBindingTest {
}
@Test
- public void writeCopyReadBufferTest() throws IOException {
-
- out.println(" - - - highLevelTest; copy buffer test - - - ");
-
- final int elements = NUM_ELEMENTS;
-
- CLContext context = CLContext.create();
-
- // the CL.MEM_* flag is probably completly irrelevant in our case since we do not use a kernel in this test
- CLBuffer<ByteBuffer> clBufferA = context.createByteBuffer(elements*SIZEOF_INT, Mem.READ_ONLY);
- CLBuffer<ByteBuffer> clBufferB = context.createByteBuffer(elements*SIZEOF_INT, Mem.READ_ONLY);
-
- // fill only first read buffer -> we will copy the payload to the second later.
- fillBuffer(clBufferA.buffer, 12345);
-
- CLCommandQueue queue = context.getCLDevices()[0].createCommandQueue();
-
- // asynchronous write of data to GPU device, blocking read later to get the computed results back.
- queue.putWriteBuffer(clBufferA, false) // write A
- .putCopyBuffer(clBufferA, clBufferB, clBufferA.buffer.capacity()) // copy A -> B
- .putReadBuffer(clBufferB, true) // read B
- .finish();
-
- context.release();
-
- out.println("validating computed results...");
- checkIfEqual(clBufferA.buffer, clBufferB.buffer, elements);
- out.println("results are valid");
-
- }
-
- @Test
- public void bufferWithHostPointerTest() throws IOException {
-
- out.println(" - - - highLevelTest; host pointer test - - - ");
-
- final int elements = NUM_ELEMENTS;
-
- CLContext context = CLContext.create();
-
- ByteBuffer buffer = BufferUtil.newByteBuffer(elements*SIZEOF_INT);
- // fill only first read buffer -> we will copy the payload to the second later.
- fillBuffer(buffer, 12345);
-
- CLCommandQueue queue = context.getCLDevices()[0].createCommandQueue();
-
- Mem[] bufferConfig = new Mem[] {Mem.COPY_BUFFER, Mem.USE_BUFFER};
-
- for(int i = 0; i < bufferConfig.length; i++) {
-
- out.println("testing with "+bufferConfig[i] + " config");
-
- CLBuffer<ByteBuffer> clBufferA = context.createBuffer(buffer, Mem.READ_ONLY, bufferConfig[i]);
- CLBuffer<ByteBuffer> clBufferB = context.createByteBuffer(elements*SIZEOF_INT, Mem.READ_ONLY);
-
- // asynchronous write of data to GPU device, blocking read later to get the computed results back.
- queue.putCopyBuffer(clBufferA, clBufferB, clBufferA.buffer.capacity()) // copy A -> B
- .putReadBuffer(clBufferB, true) // read B
- .finish();
-
- clBufferA.release();
- clBufferB.release();
-
- // uploading worked when a==b.
- out.println("validating computed results...");
- checkIfEqual(clBufferA.buffer, clBufferB.buffer, elements);
- out.println("results are valid");
- }
-
- context.release();
- }
-
- @Test
public void rebuildProgramTest() throws IOException {
out.println(" - - - highLevelTest; rebuild program test - - - ");
@@ -300,19 +223,5 @@ public class HighLevelBindingTest {
}
- private final void checkIfEqual(ByteBuffer a, ByteBuffer b, int elements) {
- for(int i = 0; i < elements; i++) {
- int aVal = a.getInt();
- int bVal = b.getInt();
- if(aVal != bVal) {
- out.println("a: "+aVal);
- out.println("b: "+bVal);
- out.println("position: "+a.position());
- fail("a!=b");
- }
- }
- a.rewind();
- b.rewind();
- }
}