summaryrefslogtreecommitdiffstats
path: root/test/com
diff options
context:
space:
mode:
Diffstat (limited to 'test/com')
-rw-r--r--test/com/jogamp/opencl/CLBufferTest.java77
-rw-r--r--test/com/jogamp/opencl/CLCommandQueueTest.java125
-rw-r--r--test/com/jogamp/opencl/CLExceptionTest.java12
-rw-r--r--test/com/jogamp/opencl/CLImageTest.java56
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java64
-rw-r--r--test/com/jogamp/opencl/HighLevelBindingTest.java89
-rw-r--r--test/com/jogamp/opencl/LowLevelBindingTest.java147
-rw-r--r--test/com/jogamp/opencl/TestJoclVersion.java6
-rw-r--r--test/com/jogamp/opencl/gl/CLGLTest.java96
-rw-r--r--test/com/jogamp/opencl/test/util/MiscUtils.java14
-rw-r--r--test/com/jogamp/opencl/test/util/UITestCase.java14
-rw-r--r--test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java44
12 files changed, 382 insertions, 362 deletions
diff --git a/test/com/jogamp/opencl/CLBufferTest.java b/test/com/jogamp/opencl/CLBufferTest.java
index 53222014..d5995903 100644
--- a/test/com/jogamp/opencl/CLBufferTest.java
+++ b/test/com/jogamp/opencl/CLBufferTest.java
@@ -69,18 +69,18 @@ public class CLBufferTest extends UITestCase {
out.println(" - - - highLevelTest; create buffer test - - - ");
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
try{
- int size = 6;
+ final int size = 6;
- CLBuffer<ByteBuffer> bb = context.createByteBuffer(size);
- CLBuffer<ShortBuffer> sb = context.createShortBuffer(size);
- CLBuffer<IntBuffer> ib = context.createIntBuffer(size);
- CLBuffer<LongBuffer> lb = context.createLongBuffer(size);
- CLBuffer<FloatBuffer> fb = context.createFloatBuffer(size);
- CLBuffer<DoubleBuffer> db = context.createDoubleBuffer(size);
+ final CLBuffer<ByteBuffer> bb = context.createByteBuffer(size);
+ final CLBuffer<ShortBuffer> sb = context.createShortBuffer(size);
+ final CLBuffer<IntBuffer> ib = context.createIntBuffer(size);
+ final CLBuffer<LongBuffer> lb = context.createLongBuffer(size);
+ final CLBuffer<FloatBuffer> fb = context.createFloatBuffer(size);
+ final CLBuffer<DoubleBuffer> db = context.createDoubleBuffer(size);
- List<CLMemory<? extends Buffer>> buffers = context.getMemoryObjects();
+ final List<CLMemory<? extends Buffer>> buffers = context.getMemoryObjects();
assertEquals(6, buffers.size());
assertEquals(1, bb.getElementSize());
@@ -90,19 +90,19 @@ public class CLBufferTest extends UITestCase {
assertEquals(4, fb.getElementSize());
assertEquals(8, db.getElementSize());
- ByteBuffer anotherNIO = newDirectByteBuffer(2);
+ final ByteBuffer anotherNIO = newDirectByteBuffer(2);
- for (CLMemory<? extends Buffer> memory : buffers) {
+ for (final CLMemory<? extends Buffer> memory : buffers) {
- CLBuffer<? extends Buffer> buffer = (CLBuffer<? extends Buffer>) memory;
- Buffer nio = buffer.getBuffer();
+ final CLBuffer<? extends Buffer> buffer = (CLBuffer<? extends Buffer>) memory;
+ final Buffer nio = buffer.getBuffer();
assertEquals(nio.capacity(), buffer.getCLCapacity());
assertEquals(buffer.getNIOSize(), buffer.getCLSize());
assertEquals(sizeOfBufferElem(nio), buffer.getElementSize());
assertEquals(nio.capacity() * sizeOfBufferElem(nio), buffer.getCLSize());
- CLBuffer<ByteBuffer> clone = buffer.cloneWith(anotherNIO);
+ final CLBuffer<ByteBuffer> clone = buffer.cloneWith(anotherNIO);
assertEquals(buffer.ID, clone.ID);
assertTrue(clone.equals(buffer));
@@ -126,16 +126,16 @@ public class CLBufferTest extends UITestCase {
final int elements = NUM_ELEMENTS;
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
// the CL.MEM_* flag is probably completely 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);
+ final CLBuffer<ByteBuffer> clBufferA = context.createByteBuffer(elements*SIZEOF_INT, Mem.READ_ONLY);
+ final 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.getDevices()[0].createCommandQueue();
+ final CLCommandQueue queue = context.getDevices()[0].createCommandQueue();
// asynchronous write of data to GPU device, blocking read later to get the computed results back.
queue.putWriteBuffer(clBufferA, false) // write A
@@ -158,22 +158,22 @@ public class CLBufferTest extends UITestCase {
final int elements = NUM_ELEMENTS;
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
- ByteBuffer buffer = Buffers.newDirectByteBuffer(elements*SIZEOF_INT);
+ final ByteBuffer buffer = Buffers.newDirectByteBuffer(elements*SIZEOF_INT);
// fill only first read buffer -> we will copy the payload to the second later.
fillBuffer(buffer, 12345);
- CLCommandQueue queue = context.getDevices()[0].createCommandQueue();
+ final CLCommandQueue queue = context.getDevices()[0].createCommandQueue();
- Mem[] bufferConfig = new Mem[] {Mem.COPY_BUFFER, Mem.USE_BUFFER};
+ final 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);
+ final CLBuffer<ByteBuffer> clBufferA = context.createBuffer(buffer, Mem.READ_ONLY, bufferConfig[i]);
+ final 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
@@ -223,10 +223,10 @@ public class CLBufferTest extends UITestCase {
clBufferB = context.createByteBuffer(sizeInBytes, Mem.READ_WRITE, Mem.USE_BUFFER);
}
- CLCommandQueue queue = context.getDevices()[0].createCommandQueue();
+ final CLCommandQueue queue = context.getDevices()[0].createCommandQueue();
// fill only first buffer -> we will copy the payload to the second later.
- ByteBuffer mappedBufferA = queue.putMapBuffer(clBufferA, Map.WRITE, true);
+ final ByteBuffer mappedBufferA = queue.putMapBuffer(clBufferA, Map.WRITE, true);
assertEquals(sizeInBytes, mappedBufferA.capacity());
fillBuffer(mappedBufferA, 12345); // write to A
@@ -235,7 +235,7 @@ public class CLBufferTest extends UITestCase {
.putCopyBuffer(clBufferA, clBufferB); // copy A -> B
// map B for read operations
- ByteBuffer mappedBufferB = queue.putMapBuffer(clBufferB, Map.READ, true);
+ final ByteBuffer mappedBufferB = queue.putMapBuffer(clBufferB, Map.READ, true);
assertEquals(sizeInBytes, mappedBufferB.capacity());
out.println("validating computed results...");
@@ -254,13 +254,14 @@ public class CLBufferTest extends UITestCase {
out.println(" - - - subBufferTest - - - ");
@SuppressWarnings("unchecked")
+ final
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
if(platform == null) {
out.println("aborting subBufferTest");
return;
}
- CLContext context = CLContext.create(platform);
+ final CLContext context = CLContext.create(platform);
try{
final int subelements = 5;
final long lMaxAlignment = context.getMaxMemBaseAddrAlign();
@@ -270,13 +271,13 @@ public class CLBufferTest extends UITestCase {
throw new RuntimeException("Cannot handle MaxMemBaseAddrAlign > MAX_INT, has 0x"+Long.toHexString(lMaxAlignment));
}
// device only
- CLBuffer<?> buffer = context.createBuffer(iMaxAlignment+subelements);
+ final CLBuffer<?> buffer = context.createBuffer(iMaxAlignment+subelements);
assertFalse(buffer.isSubBuffer());
assertNotNull(buffer.getSubBuffers());
assertTrue(buffer.getSubBuffers().isEmpty());
- CLSubBuffer<?> subBuffer = buffer.createSubBuffer(iMaxAlignment, subelements);
+ final CLSubBuffer<?> subBuffer = buffer.createSubBuffer(iMaxAlignment, subelements);
assertTrue(subBuffer.isSubBuffer());
assertEquals(subelements, subBuffer.getCLSize());
@@ -299,13 +300,14 @@ public class CLBufferTest extends UITestCase {
out.println(" - - - subBufferTest - - - ");
@SuppressWarnings("unchecked")
+ final
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
if(platform == null) {
out.println("aborting subBufferTest");
return;
}
- CLContext context = CLContext.create(platform);
+ final CLContext context = CLContext.create(platform);
try{
final int subelements = 5;
final long lMaxAlignment = context.getMaxMemBaseAddrAlign();
@@ -317,12 +319,12 @@ public class CLBufferTest extends UITestCase {
// FIXME: See Bug 979: Offset/Alignment via offset calculation per element-count is faulty!
final int floatsPerAlignment = iMaxAlignment / Buffers.SIZEOF_FLOAT;
// device + direct buffer
- CLBuffer<FloatBuffer> buffer = context.createFloatBuffer(floatsPerAlignment+subelements);
+ final CLBuffer<FloatBuffer> buffer = context.createFloatBuffer(floatsPerAlignment+subelements);
assertFalse(buffer.isSubBuffer());
assertNotNull(buffer.getSubBuffers());
assertTrue(buffer.getSubBuffers().isEmpty());
- CLSubBuffer<FloatBuffer> subBuffer = buffer.createSubBuffer(floatsPerAlignment, subelements);
+ final CLSubBuffer<FloatBuffer> subBuffer = buffer.createSubBuffer(floatsPerAlignment, subelements);
assertTrue(subBuffer.isSubBuffer());
assertEquals(subelements, subBuffer.getBuffer().capacity());
@@ -348,13 +350,14 @@ public class CLBufferTest extends UITestCase {
out.println(" - - - destructorCallbackTest - - - ");
@SuppressWarnings("unchecked")
+ final
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
if(platform == null) {
out.println("aborting destructorCallbackTest");
return;
}
- CLContext context = CLContext.create(platform);
+ final CLContext context = CLContext.create(platform);
try{
@@ -362,7 +365,7 @@ public class CLBufferTest extends UITestCase {
final CountDownLatch countdown = new CountDownLatch(1);
buffer.registerDestructorCallback(new CLMemObjectListener() {
- public void memoryDeallocated(CLMemory<?> mem) {
+ public void memoryDeallocated(final CLMemory<?> mem) {
out.println("buffer released");
assertEquals(mem, buffer);
countdown.countDown();
@@ -380,8 +383,8 @@ public class CLBufferTest extends UITestCase {
}
- public static void main(String[] args) throws IOException {
- String tstname = CLBufferTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = CLBufferTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
}
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java
index 9b3ed50e..c5c3f94c 100644
--- a/test/com/jogamp/opencl/CLCommandQueueTest.java
+++ b/test/com/jogamp/opencl/CLCommandQueueTest.java
@@ -43,6 +43,7 @@ import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.util.CLDeviceFilters;
import com.jogamp.opencl.util.CLPlatformFilters;
import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.llb.CLCommandQueueBinding;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -73,26 +74,26 @@ public class CLCommandQueueTest extends UITestCase {
public void enumsTest() {
//CLCommandQueueEnums
- EnumSet<Mode> queueMode = Mode.valuesOf(CL.CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL.CL_QUEUE_PROFILING_ENABLE);
+ final EnumSet<Mode> queueMode = Mode.valuesOf(CLCommandQueueBinding.CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CLCommandQueueBinding.CL_QUEUE_PROFILING_ENABLE);
assertTrue(queueMode.contains(OUT_OF_ORDER_MODE));
assertTrue(queueMode.contains(PROFILING_MODE));
assertNotNull(Mode.valuesOf(0));
assertEquals(0, Mode.valuesOf(0).size());
- for (Mode mode : Mode.values()) {
+ for (final Mode mode : Mode.values()) {
assertEquals(mode, Mode.valueOf(mode.QUEUE_MODE));
}
// CLEvent enums
- for (ProfilingCommand cmd : ProfilingCommand.values()) {
+ for (final ProfilingCommand cmd : ProfilingCommand.values()) {
assertEquals(cmd, ProfilingCommand.valueOf(cmd.COMMAND));
}
- for (CommandType type : CommandType.values()) {
+ for (final CommandType type : CommandType.values()) {
assertEquals(type, CommandType.valueOf(type.TYPE));
}
- for (ExecutionStatus status : ExecutionStatus.values()) {
+ for (final ExecutionStatus status : ExecutionStatus.values()) {
assertEquals(status, ExecutionStatus.valueOf(status.STATUS));
}
@@ -103,25 +104,25 @@ public class CLCommandQueueTest extends UITestCase {
out.println(" - - - event synchronization test - - - ");
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
try{
- CLDevice device = context.getDevices()[0];
- int groupSize = device.getMaxWorkItemSizes()[0];
+ final CLDevice device = context.getDevices()[0];
+ final int groupSize = device.getMaxWorkItemSizes()[0];
final int elements = roundUp(groupSize, ONE_MB / SIZEOF_INT * 5); // 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);
- CLBuffer<ByteBuffer> clBufferC = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
- CLBuffer<ByteBuffer> clBufferD = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferA = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferB = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferC = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferD = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
fillBuffer(clBufferA.buffer, 12345);
fillBuffer(clBufferB.buffer, 67890);
- CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
- CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM").setArg(3, elements);
- CLCommandQueue queue = device.createCommandQueue();
+ final CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
+ final CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM").setArg(3, elements);
+ final CLCommandQueue queue = device.createCommandQueue();
out.println(queue);
@@ -174,7 +175,7 @@ public class CLCommandQueueTest extends UITestCase {
out.println(" - - - event conditions test - - - ");
- CLPlatform platform = CLPlatform.getDefault(CLPlatformFilters.queueMode(OUT_OF_ORDER_MODE));
+ final CLPlatform platform = CLPlatform.getDefault(CLPlatformFilters.queueMode(OUT_OF_ORDER_MODE));
CLDevice device = null;
// we can still test this with in-order queues
@@ -184,15 +185,15 @@ public class CLCommandQueueTest extends UITestCase {
device = platform.getMaxFlopsDevice(CLDeviceFilters.queueMode(OUT_OF_ORDER_MODE));
}
- CLContext context = CLContext.create(device);
+ final CLContext context = CLContext.create(device);
try{
- CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
+ final CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
- CLBuffer<IntBuffer> buffer = context.createBuffer(newDirectIntBuffer(new int[]{ 1,1,1, 1,1,1, 1,1,1 }));
+ final CLBuffer<IntBuffer> buffer = context.createBuffer(newDirectIntBuffer(new int[]{ 1,1,1, 1,1,1, 1,1,1 }));
- int elements = buffer.getNIOCapacity();
+ final int elements = buffer.getNIOCapacity();
CLCommandQueue queue;
if(device.getQueueProperties().contains(OUT_OF_ORDER_MODE)) {
@@ -202,11 +203,11 @@ public class CLCommandQueueTest extends UITestCase {
}
// simulate in-order queue by accumulating events of prior commands
- CLEventList events = new CLEventList(3);
+ final CLEventList events = new CLEventList(3);
// (1+1)*2 = 4; conditions enforce propper order
- CLKernel addKernel = program.createCLKernel("add").putArg(buffer).putArg(1).putArg(elements);
- CLKernel mulKernel = program.createCLKernel("mul").putArg(buffer).putArg(2).putArg(elements);
+ final CLKernel addKernel = program.createCLKernel("add").putArg(buffer).putArg(1).putArg(elements);
+ final CLKernel mulKernel = program.createCLKernel("mul").putArg(buffer).putArg(2).putArg(elements);
queue.putWriteBuffer(buffer, false, events);
@@ -234,24 +235,24 @@ public class CLCommandQueueTest extends UITestCase {
out.println(" - - - event synchronization test - - - ");
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
try {
- CLDevice device = context.getDevices()[0];
- int groupSize = device.getMaxWorkItemSizes()[0];
+ final CLDevice device = context.getDevices()[0];
+ final int groupSize = device.getMaxWorkItemSizes()[0];
final int elements = roundUp(groupSize, ONE_MB / SIZEOF_INT * 5); // 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);
- CLBuffer<ByteBuffer> clBufferC = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferA = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferB = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferC = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
fillBuffer(clBufferA.buffer, 12345);
fillBuffer(clBufferB.buffer, 67890);
- CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
- CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM").setArg(3, elements);
- CLCommandQueue queue = device.createCommandQueue(PROFILING_MODE);
+ final CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
+ final CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM").setArg(3, elements);
+ final CLCommandQueue queue = device.createCommandQueue(PROFILING_MODE);
out.println(queue);
@@ -266,14 +267,14 @@ public class CLCommandQueueTest extends UITestCase {
queue.put1DRangeKernel(vectorAddKernel, 0, elements, groupSize, events);
assertEquals(1, events.size());
- CLEvent probe = events.getEvent(0);
+ final CLEvent probe = events.getEvent(0);
out.println(probe);
queue.putWaitForEvents(events, true);
assertEquals(CLEvent.ExecutionStatus.COMPLETE, probe.getStatus());
out.println(probe);
- long time = probe.getProfilingInfo(CLEvent.ProfilingCommand.END)
+ final long time = probe.getProfilingInfo(CLEvent.ProfilingCommand.END)
- probe.getProfilingInfo(CLEvent.ProfilingCommand.START);
out.println("time: "+time);
assertTrue(time > 0);
@@ -289,9 +290,9 @@ public class CLCommandQueueTest extends UITestCase {
public void customEventsTest() throws IOException, InterruptedException {
out.println(" - - - user events test - - - ");
- CLPlatform[] platforms = CLPlatform.listCLPlatforms();
+ final CLPlatform[] platforms = CLPlatform.listCLPlatforms();
CLPlatform theChosenOne = platforms[0];
- for (CLPlatform platform : platforms) {
+ for (final CLPlatform platform : platforms) {
if(platform.isAtLeast(CL_1_1)) {
theChosenOne = platform;
break;
@@ -306,21 +307,21 @@ public class CLCommandQueueTest extends UITestCase {
final CLContext context = CLContext.create(theChosenOne);
try{
- CLDevice device = context.getDevices()[0];
- int groupSize = device.getMaxWorkItemSizes()[0];
+ final CLDevice device = context.getDevices()[0];
+ final int groupSize = device.getMaxWorkItemSizes()[0];
final int elements = roundUp(groupSize, ONE_MB / SIZEOF_INT * 5); // 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);
- CLBuffer<ByteBuffer> clBufferC = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferA = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferB = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferC = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
fillBuffer(clBufferA.buffer, 12345);
fillBuffer(clBufferB.buffer, 67890);
- CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
- CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM").setArg(3, elements);
- CLCommandQueue queue = device.createCommandQueue();
+ final CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
+ final CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM").setArg(3, elements);
+ final CLCommandQueue queue = device.createCommandQueue();
queue.putWriteBuffer(clBufferA, true) // write A
.putWriteBuffer(clBufferB, true);// write B
@@ -329,7 +330,7 @@ public class CLCommandQueueTest extends UITestCase {
// the interesting part...
- CLUserEvent condition = CLUserEvent.create(context);
+ final CLUserEvent condition = CLUserEvent.create(context);
assertEquals(CommandType.USER, condition.getType());
assertEquals(ExecutionStatus.SUBMITTED, condition.getStatus());
out.println(condition);
@@ -365,14 +366,14 @@ public class CLCommandQueueTest extends UITestCase {
out.println(" - - - event callback test - - - ");
- CLPlatform platform = CLPlatform.getDefault();
+ final CLPlatform platform = CLPlatform.getDefault();
if(!platform.isAtLeast(CL_1_1)) {
out.println("test disabled, required CLVersion: "+CL_1_1+" available: "+platform.getVersion());
return;
}
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
try{
@@ -381,7 +382,7 @@ public class CLCommandQueueTest extends UITestCase {
final CountDownLatch countdown = new CountDownLatch(1);
customEvent.registerCallback(new CLEventListener() {
@Override
- public void eventStateChanged(CLEvent event, int status) {
+ public void eventStateChanged(final CLEvent event, final int status) {
out.println("event received: "+event);
assertEquals(event, customEvent);
countdown.countDown();
@@ -407,11 +408,11 @@ public class CLCommandQueueTest extends UITestCase {
final int elements = ONE_MB / SIZEOF_INT * 10; // 20MB per buffer
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
try{
- CLDevice[] devices = context.getDevices();
+ final CLDevice[] devices = context.getDevices();
// ignore this test if we can't test in parallel
if (devices.length < 2) {
@@ -427,7 +428,7 @@ public class CLCommandQueueTest extends UITestCase {
final CLBuffer<ByteBuffer> clBufferA2 = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
final CLBuffer<ByteBuffer> clBufferB2 = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
- CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
+ final CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
//two independent kernel instances
final CLKernel vectorAddKernel1 = program.createCLKernel("VectorAddGM").setArg(3, elements);
@@ -444,12 +445,12 @@ public class CLCommandQueueTest extends UITestCase {
final MultiQueueBarrier barrier = new MultiQueueBarrier(2);
- Thread thread1 = new Thread("C") {
+ final Thread thread1 = new Thread("C") {
@Override
public void run() {
- int groupSize = queue1.getDevice().getMaxWorkItemSizes()[0];
+ final int groupSize = queue1.getDevice().getMaxWorkItemSizes()[0];
fillBuffer(clBufferA1.buffer, 12345);
fillBuffer(clBufferB1.buffer, 67890);
@@ -462,7 +463,7 @@ public class CLCommandQueueTest extends UITestCase {
vectorAddKernel1.setArgs(clBufferA1, clBufferB1, clBufferC); // C = A+B
// System.out.println("C kernels");
- CLEventList events1 = new CLEventList(2);
+ final CLEventList events1 = new CLEventList(2);
queue1.put1DRangeKernel(vectorAddKernel1, 0, elements, groupSize, events1)
.putReadBuffer(clBufferC, false, events1);
@@ -471,14 +472,14 @@ public class CLCommandQueueTest extends UITestCase {
}
};
- Thread thread2 = new Thread("D") {
+ final Thread thread2 = new Thread("D") {
@Override
public void run() {
- int maxWorkItemSize = queue2.getDevice().getMaxWorkItemSizes()[0];
- int kernelWorkGroupSize = (int)vectorAddKernel2.getWorkGroupSize( queue2.getDevice() );
- int localWorkSize = Math.min( maxWorkItemSize, kernelWorkGroupSize );
+ final int maxWorkItemSize = queue2.getDevice().getMaxWorkItemSizes()[0];
+ final int kernelWorkGroupSize = (int)vectorAddKernel2.getWorkGroupSize( queue2.getDevice() );
+ final int localWorkSize = Math.min( maxWorkItemSize, kernelWorkGroupSize );
fillBuffer(clBufferA2.buffer, 12345);
fillBuffer(clBufferB2.buffer, 67890);
@@ -491,7 +492,7 @@ public class CLCommandQueueTest extends UITestCase {
vectorAddKernel2.setArgs(clBufferA2, clBufferB2, clBufferD); // D = A+B
// System.out.println("D kernels");
- CLEventList events2 = new CLEventList(2);
+ final CLEventList events2 = new CLEventList(2);
queue2.put1DRangeKernel(vectorAddKernel2, 0, elements, localWorkSize, events2);
queue2.putReadBuffer(clBufferD, false, events2);
@@ -509,15 +510,15 @@ public class CLCommandQueueTest extends UITestCase {
checkIfEqual(clBufferC.buffer, clBufferD.buffer, elements);
out.println("results are valid");
- } catch (Throwable t ) {
+ } catch (final Throwable t ) {
t.printStackTrace();
} finally {
context.release();
}
}
- public static void main(String[] args) throws IOException {
- String tstname = CLCommandQueueTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = CLCommandQueueTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
}
diff --git a/test/com/jogamp/opencl/CLExceptionTest.java b/test/com/jogamp/opencl/CLExceptionTest.java
index 5a1ce89b..8a61fd0f 100644
--- a/test/com/jogamp/opencl/CLExceptionTest.java
+++ b/test/com/jogamp/opencl/CLExceptionTest.java
@@ -47,20 +47,20 @@ public class CLExceptionTest extends UITestCase {
@Test
public void testCLExceptions() throws InstantiationException, IllegalAccessException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
- Class<?>[] subTypes = CLException.class.getDeclaredClasses();
+ final Class<?>[] subTypes = CLException.class.getDeclaredClasses();
- for (Class<?> type : subTypes) {
+ for (final Class<?> type : subTypes) {
if(type.getName().startsWith(CLException.class.getName()+"$CL")) {
- CLException exception = (CLException) type.getConstructor(String.class).newInstance("foo");
+ final CLException exception = (CLException) type.getConstructor(String.class).newInstance("foo");
assertNotNull("can not resolve "+exception, CLException.resolveErrorCode(exception.errorcode));
try{
CLException.checkForError(exception.errorcode, "foo");
fail("expected exception for: "+exception.getClass().getName()+" code: "+exception.errorcode);
- }catch(CLException ex) {
+ }catch(final CLException ex) {
assertTrue("wrong instance; expected "+exception.getClass()+" but got "+ex.getClass(),
exception.getClass().equals(ex.getClass()));
}
@@ -68,8 +68,8 @@ public class CLExceptionTest extends UITestCase {
}
}
- public static void main(String[] args) throws IOException {
- String tstname = CLExceptionTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = CLExceptionTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
}
diff --git a/test/com/jogamp/opencl/CLImageTest.java b/test/com/jogamp/opencl/CLImageTest.java
index 5f5c0503..17bcd65f 100644
--- a/test/com/jogamp/opencl/CLImageTest.java
+++ b/test/com/jogamp/opencl/CLImageTest.java
@@ -60,18 +60,18 @@ public class CLImageTest extends UITestCase {
@BeforeClass
public static void init() throws IOException {
- BufferedImage bi = ImageIO.read(CLImageTest.class.getResourceAsStream("jogamp.png"));
+ final BufferedImage bi = ImageIO.read(CLImageTest.class.getResourceAsStream("jogamp.png"));
pixels = new int[128*128*4];
bi.getData().getPixels(0, 0, 128, 128, pixels);
}
public CLDevice getCompatibleDevice() {
- CLPlatform[] platforms = CLPlatform.listCLPlatforms();
- for (CLPlatform platform : platforms) {
- CLDevice[] devices = platform.listCLDevices();
+ final CLPlatform[] platforms = CLPlatform.listCLPlatforms();
+ for (final CLPlatform platform : platforms) {
+ final CLDevice[] devices = platform.listCLDevices();
- for (CLDevice device : devices) {
+ for (final CLDevice device : devices) {
if(device.isImageSupportAvailable()) {
return device;
}
@@ -84,15 +84,15 @@ public class CLImageTest extends UITestCase {
@Test
public void supportedImageFormatsTest() {
- CLDevice device = getCompatibleDevice();
+ final CLDevice device = getCompatibleDevice();
if(device == null) {
out.println("WARNING: can not test image api.");
return;
}
- CLContext context = CLContext.create(device);
+ final CLContext context = CLContext.create(device);
try{
- CLImageFormat[] formats = context.getSupportedImage2dFormats();
+ final CLImageFormat[] formats = context.getSupportedImage2dFormats();
assertTrue(formats.length > 0);
out.println("sample image format: "+formats[0]);
// for (CLImageFormat format : formats) {
@@ -106,28 +106,28 @@ public class CLImageTest extends UITestCase {
@Test
public void image2dCopyTest() throws IOException {
- CLDevice device = getCompatibleDevice();
+ final CLDevice device = getCompatibleDevice();
if(device == null) {
out.println("WARNING: can not test image api.");
return;
}
- CLContext context = CLContext.create(device);
+ final CLContext context = CLContext.create(device);
- CLCommandQueue queue = device.createCommandQueue();
+ final CLCommandQueue queue = device.createCommandQueue();
try{
- CLImageFormat format = new CLImageFormat(RGBA, UNSIGNED_INT32);
+ final CLImageFormat format = new CLImageFormat(RGBA, UNSIGNED_INT32);
- CLImage2d<IntBuffer> imageA = context.createImage2d(newDirectIntBuffer(pixels), 128, 128, format);
- CLImage2d<IntBuffer> imageB = context.createImage2d(newDirectIntBuffer(pixels.length), 128, 128, format);
+ final CLImage2d<IntBuffer> imageA = context.createImage2d(newDirectIntBuffer(pixels), 128, 128, format);
+ final CLImage2d<IntBuffer> imageB = context.createImage2d(newDirectIntBuffer(pixels.length), 128, 128, format);
queue.putWriteImage(imageA, false)
.putCopyImage(imageA, imageB)
.putReadImage(imageB, true);
- IntBuffer bufferA = imageA.getBuffer();
- IntBuffer bufferB = imageB.getBuffer();
+ final IntBuffer bufferA = imageA.getBuffer();
+ final IntBuffer bufferB = imageB.getBuffer();
while(bufferA.hasRemaining()) {
assertEquals(bufferA.get(), bufferB.get());
@@ -141,14 +141,14 @@ public class CLImageTest extends UITestCase {
@Test
public void image2dKernelCopyTest() throws IOException {
- CLDevice device = getCompatibleDevice();
+ final CLDevice device = getCompatibleDevice();
if(device == null) {
out.println("WARNING: can not test image api.");
return;
}
- CLContext context = CLContext.create(device);
+ final CLContext context = CLContext.create(device);
- String src =
+ final String src =
"constant sampler_t imageSampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST; \n" +
"kernel void image2dCopy(read_only image2d_t input, write_only image2d_t output) { \n" +
" int2 coord = (int2)(get_global_id(0), get_global_id(1)); \n" +
@@ -156,24 +156,24 @@ public class CLImageTest extends UITestCase {
" write_imageui(output, coord, temp); \n" +
"} \n";
- CLKernel kernel = context.createProgram(src).build().createCLKernel("image2dCopy");
+ final CLKernel kernel = context.createProgram(src).build().createCLKernel("image2dCopy");
- CLCommandQueue queue = device.createCommandQueue();
+ final CLCommandQueue queue = device.createCommandQueue();
try{
- CLImageFormat format = new CLImageFormat(RGBA, UNSIGNED_INT32);
+ final CLImageFormat format = new CLImageFormat(RGBA, UNSIGNED_INT32);
- CLImage2d<IntBuffer> imageA = context.createImage2d(newDirectIntBuffer(pixels), 128, 128, format);
- CLImage2d<IntBuffer> imageB = context.createImage2d(newDirectIntBuffer(pixels.length), 128, 128, format);
+ final CLImage2d<IntBuffer> imageA = context.createImage2d(newDirectIntBuffer(pixels), 128, 128, format);
+ final CLImage2d<IntBuffer> imageB = context.createImage2d(newDirectIntBuffer(pixels.length), 128, 128, format);
kernel.putArgs(imageA, imageB);
queue.putWriteImage(imageA, false)
.put2DRangeKernel(kernel, 0, 0, 128, 128, 0, 0)
.putReadImage(imageB, true);
- IntBuffer bufferA = imageA.getBuffer();
- IntBuffer bufferB = imageB.getBuffer();
+ final IntBuffer bufferA = imageA.getBuffer();
+ final IntBuffer bufferB = imageB.getBuffer();
while(bufferA.hasRemaining()) {
assertEquals(bufferA.get(), bufferB.get());
@@ -184,8 +184,8 @@ public class CLImageTest extends UITestCase {
}
}
- public static void main(String[] args) throws IOException {
- String tstname = CLImageTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = CLImageTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index cf74f4f2..e5baeb2c 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -70,7 +70,7 @@ public class CLProgramTest extends UITestCase {
public void enumsTest() {
// CLProgram enums
- for (Status e : Status.values()) {
+ for (final Status e : Status.values()) {
assertEquals(e, Status.valueOf(e.STATUS));
}
}
@@ -80,8 +80,8 @@ public class CLProgramTest extends UITestCase {
out.println(" - - - CLProgramTest; rebuild program test - - - ");
- CLContext context = CLContext.create();
- CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl"));
+ final CLContext context = CLContext.create();
+ final CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl"));
// only test kernel creation error on unbuilt program if we're not on AMD -- as of
// 3/8/2014, AMD drivers segfault on this instead of returning CL_INVALID_PROGRAM_EXECUTABLE
@@ -89,7 +89,7 @@ public class CLProgramTest extends UITestCase {
try{
program.createCLKernels();
fail("expected exception but got none :(");
- }catch(CLException ex) {
+ }catch(final CLException ex) {
out.println("got expected exception: "+ex.getCLErrorString());
assertEquals(ex.errorcode, CL.CL_INVALID_PROGRAM_EXECUTABLE);
}
@@ -123,16 +123,16 @@ public class CLProgramTest extends UITestCase {
out.println(" - - - CLProgramTest; down-/upload binaries test - - - ");
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl"))
.build(ENABLE_MAD, WARNINGS_ARE_ERRORS);
// obtain binaries
- Map<CLDevice, byte[]> binaries = program.getBinaries();
+ final Map<CLDevice, byte[]> binaries = program.getBinaries();
assertFalse(binaries.isEmpty());
- CLDevice[] devices = program.getCLDevices();
- for (CLDevice device : devices) {
+ final CLDevice[] devices = program.getCLDevices();
+ for (final CLDevice device : devices) {
assertTrue(binaries.containsKey(device));
}
@@ -155,7 +155,7 @@ public class CLProgramTest extends UITestCase {
assertEquals(program.getCLDevices().length, 0);
{
- Map<String, CLKernel> kernels = program.createCLKernels();
+ final Map<String, CLKernel> kernels = program.createCLKernels();
assertNotNull(kernels);
assertEquals(kernels.size(), 0);
}
@@ -181,9 +181,9 @@ public class CLProgramTest extends UITestCase {
// 3/8/2014, AMD drivers segfault on this instead of returning CL_INVALID_PROGRAM_EXECUTABLE
if(!context.getPlatform().isVendorAMD()) {
try{
- Map<String, CLKernel> kernels = program.createCLKernels();
+ final Map<String, CLKernel> kernels = program.createCLKernels();
fail("expected an exception from createCLKernels but got: "+kernels);
- }catch(CLException ex) {
+ }catch(final CLException ex) {
// expected, not built yet
}
}
@@ -204,7 +204,7 @@ public class CLProgramTest extends UITestCase {
public void builderTest() throws IOException, ClassNotFoundException, InterruptedException {
out.println(" - - - CLProgramTest; program builder test - - - ");
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl"));
// same as program.build()
@@ -223,7 +223,7 @@ public class CLProgramTest extends UITestCase {
assertTrue(program.isExecutable());
// reusable builder
- CLBuildConfiguration builder = CLProgramBuilder.createConfiguration()
+ final CLBuildConfiguration builder = CLProgramBuilder.createConfiguration()
.withOption(ENABLE_MAD)
.forDevices(context.getDevices())
.withDefine("RADIUS", 5)
@@ -236,9 +236,9 @@ public class CLProgramTest extends UITestCase {
final CountDownLatch countdown = new CountDownLatch(1);
final CLProgram outerProgram = program;
- CLBuildListener buildCallback = new CLBuildListener() {
+ final CLBuildListener buildCallback = new CLBuildListener() {
@Override
- public void buildFinished(CLProgram program) {
+ public void buildFinished(final CLProgram program) {
assertEquals(outerProgram, program);
countdown.countDown();
}
@@ -251,14 +251,14 @@ public class CLProgramTest extends UITestCase {
assertTrue(program.isExecutable());
// serialization test
- File file = tmpFolder.newFile("foobar.builder");
- ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
+ final File file = tmpFolder.newFile("foobar.builder");
+ final ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
builder.save(oos);
oos.close();
// build configuration
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
- CLBuildConfiguration buildConfig = CLProgramBuilder.loadConfiguration(ois);
+ final CLBuildConfiguration buildConfig = CLProgramBuilder.loadConfiguration(ois);
ois.close();
assertEquals(builder, buildConfig);
@@ -268,7 +268,7 @@ public class CLProgramTest extends UITestCase {
// program configuration
ois = new ObjectInputStream(new FileInputStream(file));
- CLProgramConfiguration programConfig = CLProgramBuilder.loadConfiguration(ois, context);
+ final CLProgramConfiguration programConfig = CLProgramBuilder.loadConfiguration(ois, context);
assertNotNull(programConfig.getProgram());
ois.close();
program = programConfig.build();
@@ -284,18 +284,18 @@ public class CLProgramTest extends UITestCase {
@Test
public void kernelTest() {
- String source = "__attribute__((reqd_work_group_size(1, 1, 1))) kernel void foo(float a, int b, short c) { }\n";
+ final String source = "__attribute__((reqd_work_group_size(1, 1, 1))) kernel void foo(float a, int b, short c) { }\n";
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
try{
- CLProgram program = context.createProgram(source).build();
+ final CLProgram program = context.createProgram(source).build();
assertTrue(program.isExecutable());
- CLKernel kernel = program.createCLKernel("foo");
+ final CLKernel kernel = program.createCLKernel("foo");
assertNotNull(kernel);
- long[] wgs = kernel.getCompileWorkGroupSize(context.getDevices()[0]);
+ final long[] wgs = kernel.getCompileWorkGroupSize(context.getDevices()[0]);
out.println("compile workgroup size: " + wgs[0]+" "+wgs[1]+" "+wgs[2]);
@@ -318,7 +318,7 @@ public class CLProgramTest extends UITestCase {
try{
kernel.putArg(3);
fail("exception not thrown");
- }catch (IndexOutOfBoundsException expected){ }
+ }catch (final IndexOutOfBoundsException expected){ }
assertEquals(3, kernel.position());
assertEquals(0, kernel.rewind().position());
@@ -332,16 +332,16 @@ public class CLProgramTest extends UITestCase {
@Test
public void createAllKernelsTest() {
- String source = "kernel void foo(int a) { }\n"+
+ final String source = "kernel void foo(int a) { }\n"+
"kernel void bar(float b) { }\n";
- CLContext context = CLContext.create();
+ final CLContext context = CLContext.create();
try{
- CLProgram program = context.createProgram(source).build();
+ final CLProgram program = context.createProgram(source).build();
assertTrue(program.isExecutable());
- Map<String, CLKernel> kernels = program.createCLKernels();
- for (CLKernel kernel : kernels.values()) {
+ final Map<String, CLKernel> kernels = program.createCLKernels();
+ for (final CLKernel kernel : kernels.values()) {
out.println("kernel: "+kernel.toString());
}
@@ -367,8 +367,8 @@ public class CLProgramTest extends UITestCase {
}
}
- public static void main(String[] args) throws IOException {
- String tstname = CLProgramTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = CLProgramTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java
index a4ce8e74..aee6321c 100644
--- a/test/com/jogamp/opencl/HighLevelBindingTest.java
+++ b/test/com/jogamp/opencl/HighLevelBindingTest.java
@@ -40,6 +40,7 @@ import com.jogamp.opencl.CLDevice.LocalMemType;
import com.jogamp.opencl.CLDevice.Type;
import com.jogamp.opencl.CLDevice.Capabilities;
import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.llb.CLDeviceBinding;
import com.jogamp.opencl.test.util.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
@@ -82,51 +83,51 @@ public class HighLevelBindingTest extends UITestCase {
public void enumsTest() {
// enum tests
- final EnumSet<FPConfig> singleFPConfig = FPConfig.valuesOf(CL.CL_FP_DENORM | CL.CL_FP_ROUND_TO_INF);
+ final EnumSet<FPConfig> singleFPConfig = FPConfig.valuesOf(CLDeviceBinding.CL_FP_DENORM | CLDeviceBinding.CL_FP_ROUND_TO_INF);
assertEquals(0, FPConfig.valuesOf(0).size());
assertTrue(singleFPConfig.contains(FPConfig.DENORM));
assertTrue(singleFPConfig.contains(FPConfig.ROUND_TO_INF));
// CLDevice enums
- for (FPConfig e : FPConfig.values()) {
- EnumSet<FPConfig> set = FPConfig.valuesOf(e.CONFIG);
+ for (final FPConfig e : FPConfig.values()) {
+ final EnumSet<FPConfig> set = FPConfig.valuesOf(e.CONFIG);
assertTrue(set.contains(e));
}
- for (GlobalMemCacheType e : GlobalMemCacheType.values()) {
+ for (final GlobalMemCacheType e : GlobalMemCacheType.values()) {
assertEquals(e, GlobalMemCacheType.valueOf(e.TYPE));
}
- for (LocalMemType e : LocalMemType.values()) {
+ for (final LocalMemType e : LocalMemType.values()) {
assertEquals(e, LocalMemType.valueOf(e.TYPE));
}
- for (Type e : Type.values()) {
+ for (final Type e : Type.values()) {
assertEquals(e, Type.valueOf(e.TYPE));
}
- for (Capabilities e : Capabilities.values()) {
+ for (final Capabilities e : Capabilities.values()) {
assertEquals(e, Capabilities.valueOf(e.CAPS));
}
// CLMemory enums
- for (Mem e : Mem.values()) {
+ for (final Mem e : Mem.values()) {
assertEquals(e, Mem.valueOf(e.CONFIG));
}
- for (GLObjectType e : GLObjectType.values()) {
+ for (final GLObjectType e : GLObjectType.values()) {
assertEquals(e, GLObjectType.valueOf(e.TYPE));
}
// CLSampler enums
- for (AddressingMode e : AddressingMode.values()) {
+ for (final AddressingMode e : AddressingMode.values()) {
assertEquals(e, AddressingMode.valueOf(e.MODE));
}
- for (FilteringMode e : FilteringMode.values()) {
+ for (final FilteringMode e : FilteringMode.values()) {
assertEquals(e, FilteringMode.valueOf(e.MODE));
}
// CLImage enums
- for (ChannelOrder e : ChannelOrder.values()) {
+ for (final ChannelOrder e : ChannelOrder.values()) {
assertEquals(e, ChannelOrder.valueOf(e.ORDER));
}
- for (ChannelType e : ChannelType.values()) {
+ for (final ChannelType e : ChannelType.values()) {
assertEquals(e, ChannelType.valueOf(e.TYPE));
}
@@ -140,9 +141,9 @@ public class HighLevelBindingTest extends UITestCase {
out.println(" - - - highLevelTest; contextless - - - ");
// platform/device info tests
- CLPlatform[] clPlatforms = CLPlatform.listCLPlatforms();
+ final CLPlatform[] clPlatforms = CLPlatform.listCLPlatforms();
- for (CLPlatform platform : clPlatforms) {
+ for (final CLPlatform platform : clPlatforms) {
out.println("platform info:");
out.println(" name: "+platform.getName());
@@ -154,8 +155,8 @@ public class HighLevelBindingTest extends UITestCase {
out.println(" max FLOPS device: "+platform.getMaxFlopsDevice());
out.println(" extensions: "+platform.getExtensions());
- CLDevice[] clDevices = platform.listCLDevices();
- for (CLDevice device : clDevices) {
+ final CLDevice[] clDevices = platform.listCLDevices();
+ for (final CLDevice device : clDevices) {
out.println("device info:");
out.println(" name: "+device.getName());
out.println(" profile: "+device.getProfile());
@@ -207,8 +208,10 @@ public class HighLevelBindingTest extends UITestCase {
@Test
public void platformTest() {
@SuppressWarnings("unchecked")
+ final
CLPlatform platformGPU = CLPlatform.getDefault(version(CL_1_0), type(GPU));
@SuppressWarnings("unchecked")
+ final
CLPlatform platformCPU = CLPlatform.getDefault(version(CL_1_0), type(CPU));
if(platformGPU != null) {
@@ -225,9 +228,9 @@ public class HighLevelBindingTest extends UITestCase {
out.println(" - - - highLevelTest; create context - - - ");
- CLPlatform platform = CLPlatform.getDefault();
- CLDevice[] devices = platform.listCLDevices();
- int deviceCount = devices.length;
+ final CLPlatform platform = CLPlatform.getDefault();
+ final CLDevice[] devices = platform.listCLDevices();
+ final int deviceCount = devices.length;
CLContext c = CLContext.create();
assertNotNull(c);
@@ -239,7 +242,7 @@ public class HighLevelBindingTest extends UITestCase {
assertEquals(deviceCount, c.getDevices().length);
c.release();
- for (CLDevice device : devices) {
+ for (final CLDevice device : devices) {
c = CLContext.create(device);
assertNotNull(c);
assertEquals(1, c.getDevices().length);
@@ -261,19 +264,19 @@ public class HighLevelBindingTest extends UITestCase {
try{
CLContext.create((CLDevice)null);
fail("create with null device");
- }catch(IllegalArgumentException ex) {
+ }catch(final IllegalArgumentException ex) {
// expected
}
try{
CLContext.create((CLDevice.Type)null);
fail("create with null CLDevice.Type");
- }catch(IllegalArgumentException ex) {
+ }catch(final IllegalArgumentException ex) {
// expected
}
try{
CLContext.create((CLPlatform)null, (CLDevice.Type)null);
fail("create with null CLDevice.Type");
- }catch(IllegalArgumentException ex) {
+ }catch(final IllegalArgumentException ex) {
// expected
}
@@ -284,38 +287,38 @@ public class HighLevelBindingTest extends UITestCase {
out.println(" - - - highLevelTest; global memory kernel - - - ");
- CLPlatform[] clPlatforms = CLPlatform.listCLPlatforms();
- CLContext context = CLContext.create(clPlatforms[0]);
+ final CLPlatform[] clPlatforms = CLPlatform.listCLPlatforms();
+ final CLContext context = CLContext.create(clPlatforms[0]);
- CLDevice[] contextDevices = context.getDevices();
+ final CLDevice[] contextDevices = context.getDevices();
out.println("context devices:");
- for (CLDevice device : contextDevices) {
+ for (final CLDevice device : contextDevices) {
out.println(" "+device.toString());
}
out.println("max FLOPS device: " + context.getMaxFlopsDevice());
- InputStream stream = getClass().getResourceAsStream("testkernels.cl");
- CLProgram program = context.createProgram(stream).build();
+ final InputStream stream = getClass().getResourceAsStream("testkernels.cl");
+ final CLProgram program = context.createProgram(stream).build();
- CLDevice[] programDevices = program.getCLDevices();
- CLDevice device = programDevices[0];
+ final CLDevice[] programDevices = program.getCLDevices();
+ final CLDevice device = programDevices[0];
assertEquals(contextDevices.length, programDevices.length);
out.println("build log:\n"+program.getBuildLog());
out.println("build status:\n"+program.getBuildStatus());
- String source = program.getSource();
+ final String source = program.getSource();
assertFalse(source.trim().isEmpty());
// out.println("source:\n"+source);
- Map<CLDevice, byte[]> binaries = program.getBinaries();
+ final Map<CLDevice, byte[]> binaries = program.getBinaries();
assertFalse(binaries.isEmpty());
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
+ final int localWorkSize = device.getMaxWorkItemSizes()[0]; // set and log Global and Local work size dimensions
int globalWorkSize = 0;
ByteBuffer srcA = null;
@@ -333,7 +336,7 @@ public class HighLevelBindingTest extends UITestCase {
dest = newDirectByteBuffer(globalWorkSize*SIZEOF_INT);
allocated = true;
}
- catch( OutOfMemoryError oome ) {
+ catch( final OutOfMemoryError oome ) {
++divisor;
elementCount /= divisor;
out.println("not enough direct buffer memory; retrying with smaller buffers");
@@ -343,18 +346,18 @@ public class HighLevelBindingTest extends UITestCase {
fillBuffer(srcA, 23456);
fillBuffer(srcB, 46987);
- CLBuffer<ByteBuffer> clBufferA = context.createBuffer(srcA, Mem.READ_ONLY);
- CLBuffer<ByteBuffer> clBufferB = context.createBuffer(srcB, Mem.READ_ONLY);
- CLBuffer<ByteBuffer> clBufferC = context.createBuffer(dest, Mem.WRITE_ONLY);
+ final CLBuffer<ByteBuffer> clBufferA = context.createBuffer(srcA, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferB = context.createBuffer(srcB, Mem.READ_ONLY);
+ final CLBuffer<ByteBuffer> clBufferC = context.createBuffer(dest, Mem.WRITE_ONLY);
- CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM");
+ final CLKernel vectorAddKernel = program.createCLKernel("VectorAddGM");
vectorAddKernel.setArg(0, clBufferA)
.setArg(1, clBufferB)
.setArg(2, clBufferC)
.setArg(3, elementCount);
- CLCommandQueue queue = device.createCommandQueue();
+ final CLCommandQueue queue = device.createCommandQueue();
// Asynchronous write of data to GPU device, blocking read later
queue.putWriteBuffer(clBufferA, false)
@@ -387,8 +390,8 @@ public class HighLevelBindingTest extends UITestCase {
context.release();
}
- public static void main(String[] args) throws IOException {
- String tstname = HighLevelBindingTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = HighLevelBindingTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/test/com/jogamp/opencl/LowLevelBindingTest.java b/test/com/jogamp/opencl/LowLevelBindingTest.java
index ef14534a..84aaa73e 100644
--- a/test/com/jogamp/opencl/LowLevelBindingTest.java
+++ b/test/com/jogamp/opencl/LowLevelBindingTest.java
@@ -33,6 +33,11 @@ import java.util.Random;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opencl.llb.impl.BuildProgramCallback;
import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.llb.CLContextBinding;
+import com.jogamp.opencl.llb.CLDeviceBinding;
+import com.jogamp.opencl.llb.CLMemObjBinding;
+import com.jogamp.opencl.llb.CLPlatformBinding;
+import com.jogamp.opencl.llb.CLProgramBinding;
import com.jogamp.opencl.test.util.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
@@ -104,64 +109,64 @@ public class LowLevelBindingTest extends UITestCase {
out.println(" - - - lowLevelTest; contextless binding - - - ");
- CL cl = CLPlatform.getLowLevelCLInterface();
+ final CL cl = CLPlatform.getLowLevelCLInterface();
// System.out.println(((CLImpl)cl).clGetExtensionFunctionAddress("clCreateFromGLBuffer"));
// System.out.println(((CLImpl)cl).clGetExtensionFunctionAddress("clEnqueueAcquireGLObjects"));
int ret = CL.CL_SUCCESS;
- IntBuffer intBuffer = newDirectIntBuffer(1);
+ final IntBuffer intBuffer = newDirectIntBuffer(1);
// find all available OpenCL platforms
ret = cl.clGetPlatformIDs(0, null, intBuffer);
checkForError(ret);
out.println("#platforms: "+intBuffer.get(0));
- PointerBuffer platformId = PointerBuffer.allocateDirect(intBuffer.get(0));
+ final PointerBuffer platformId = PointerBuffer.allocateDirect(intBuffer.get(0));
ret = cl.clGetPlatformIDs(platformId.capacity(), platformId, null);
checkForError(ret);
// print platform info
- PointerBuffer longBuffer = PointerBuffer.allocateDirect(1);
- ByteBuffer bb = newDirectByteBuffer(128);
+ final PointerBuffer longBuffer = PointerBuffer.allocateDirect(1);
+ final ByteBuffer bb = newDirectByteBuffer(128);
for (int i = 0; i < platformId.capacity(); i++) {
- long platform = platformId.get(i);
+ final long platform = platformId.get(i);
out.println("platform id: "+platform);
- ret = cl.clGetPlatformInfo(platform, CL.CL_PLATFORM_PROFILE, bb.capacity(), bb, longBuffer);
+ ret = cl.clGetPlatformInfo(platform, CLPlatformBinding.CL_PLATFORM_PROFILE, bb.capacity(), bb, longBuffer);
checkForError(ret);
out.println(" profile: " + clString2JavaString(bb, (int)longBuffer.get(0)));
- ret = cl.clGetPlatformInfo(platform, CL.CL_PLATFORM_VERSION, bb.capacity(), bb, longBuffer);
+ ret = cl.clGetPlatformInfo(platform, CLPlatformBinding.CL_PLATFORM_VERSION, bb.capacity(), bb, longBuffer);
checkForError(ret);
out.println(" version: " + clString2JavaString(bb, (int)longBuffer.get(0)));
- ret = cl.clGetPlatformInfo(platform, CL.CL_PLATFORM_NAME, bb.capacity(), bb, longBuffer);
+ ret = cl.clGetPlatformInfo(platform, CLPlatformBinding.CL_PLATFORM_NAME, bb.capacity(), bb, longBuffer);
checkForError(ret);
out.println(" name: " + clString2JavaString(bb, (int)longBuffer.get(0)));
- ret = cl.clGetPlatformInfo(platform, CL.CL_PLATFORM_VENDOR, bb.capacity(), bb, longBuffer);
+ ret = cl.clGetPlatformInfo(platform, CLPlatformBinding.CL_PLATFORM_VENDOR, bb.capacity(), bb, longBuffer);
checkForError(ret);
out.println(" vendor: " + clString2JavaString(bb, (int)longBuffer.get(0)));
//find all devices
- ret = cl.clGetDeviceIDs(platform, CL.CL_DEVICE_TYPE_ALL, 0, null, intBuffer);
+ ret = cl.clGetDeviceIDs(platform, CLDeviceBinding.CL_DEVICE_TYPE_ALL, 0, null, intBuffer);
checkForError(ret);
out.println("#devices: "+intBuffer.get(0));
- PointerBuffer devices = PointerBuffer.allocateDirect(intBuffer.get(0));
- ret = cl.clGetDeviceIDs(platform, CL.CL_DEVICE_TYPE_ALL, devices.capacity(), devices, null);
+ final PointerBuffer devices = PointerBuffer.allocateDirect(intBuffer.get(0));
+ ret = cl.clGetDeviceIDs(platform, CLDeviceBinding.CL_DEVICE_TYPE_ALL, devices.capacity(), devices, null);
//print device info
for (int j = 0; j < devices.capacity(); j++) {
- long device = devices.get(j);
- ret = cl.clGetDeviceInfo(device, CL.CL_DEVICE_NAME, bb.capacity(), bb, longBuffer);
+ final long device = devices.get(j);
+ ret = cl.clGetDeviceInfo(device, CLDeviceBinding.CL_DEVICE_NAME, bb.capacity(), bb, longBuffer);
checkForError(ret);
out.println(" device: " + clString2JavaString(bb, (int)longBuffer.get(0)));
- ret = cl.clGetDeviceInfo(device, CL.CL_DEVICE_TYPE, bb.capacity(), bb, longBuffer);
+ ret = cl.clGetDeviceInfo(device, CLDeviceBinding.CL_DEVICE_TYPE, bb.capacity(), bb, longBuffer);
checkForError(ret);
out.println(" type: " + CLDevice.Type.valueOf(bb.get()));
bb.rewind();
@@ -176,37 +181,37 @@ public class LowLevelBindingTest extends UITestCase {
out.println(" - - - createContextTest - - - ");
- CL cl = CLPlatform.getLowLevelCLInterface();
+ final CL cl = CLPlatform.getLowLevelCLInterface();
- IntBuffer intBuffer = newDirectIntBuffer(1);
+ final IntBuffer intBuffer = newDirectIntBuffer(1);
// find all available OpenCL platforms
int ret = cl.clGetPlatformIDs(0, null, intBuffer);
checkForError(ret);
out.println("#platforms: "+intBuffer.get(0));
- PointerBuffer pb = PointerBuffer.allocateDirect(intBuffer.get(0));
+ final PointerBuffer pb = PointerBuffer.allocateDirect(intBuffer.get(0));
ret = cl.clGetPlatformIDs(pb.capacity(), pb, null);
checkForError(ret);
- long platform = pb.get(0);
+ final long platform = pb.get(0);
//find all devices
- ret = cl.clGetDeviceIDs(platform, CL.CL_DEVICE_TYPE_ALL, 0, null, intBuffer);
+ ret = cl.clGetDeviceIDs(platform, CLDeviceBinding.CL_DEVICE_TYPE_ALL, 0, null, intBuffer);
checkForError(ret);
out.println("#devices: "+intBuffer.get(0));
- PointerBuffer devices = PointerBuffer.allocateDirect(intBuffer.get(0));
- ret = cl.clGetDeviceIDs(platform, CL.CL_DEVICE_TYPE_ALL, devices.capacity(), devices, null);
+ final PointerBuffer devices = PointerBuffer.allocateDirect(intBuffer.get(0));
+ ret = cl.clGetDeviceIDs(platform, CLDeviceBinding.CL_DEVICE_TYPE_ALL, devices.capacity(), devices, null);
- long context = cl.clCreateContext(null, devices, null, intBuffer);
+ final long context = cl.clCreateContext(null, devices, null, intBuffer);
checkError("on clCreateContext", intBuffer.get());
//get number of devices
- PointerBuffer longBuffer = PointerBuffer.allocateDirect(1);
- ret = cl.clGetContextInfo(context, CL.CL_CONTEXT_DEVICES, 0, null, longBuffer);
+ final PointerBuffer longBuffer = PointerBuffer.allocateDirect(1);
+ ret = cl.clGetContextInfo(context, CLContextBinding.CL_CONTEXT_DEVICES, 0, null, longBuffer);
checkError("on clGetContextInfo", ret);
- long contextDevices = longBuffer.get(0)/(is32Bit()?4:8);
+ final long contextDevices = longBuffer.get(0)/(is32Bit()?4:8);
out.println("context created on " + contextDevices + " devices");
//check if equal
@@ -221,40 +226,40 @@ public class LowLevelBindingTest extends UITestCase {
out.println(" - - - lowLevelTest2; VectorAdd kernel - - - ");
- CL cl = CLPlatform.getLowLevelCLInterface();
+ final CL cl = CLPlatform.getLowLevelCLInterface();
int ret = CL.CL_SUCCESS;
- IntBuffer intBuffer = newDirectIntBuffer(1);
+ final IntBuffer intBuffer = newDirectIntBuffer(1);
// find all available OpenCL platforms
ret = cl.clGetPlatformIDs(0, null, intBuffer);
checkForError(ret);
assertTrue(intBuffer.get(0) > 0);
- PointerBuffer pb = PointerBuffer.allocateDirect(intBuffer.get(0));
+ final PointerBuffer pb = PointerBuffer.allocateDirect(intBuffer.get(0));
ret = cl.clGetPlatformIDs(pb.capacity(), pb, null);
checkForError(ret);
- long platform = pb.get(0);
- PointerBuffer properties = PointerBuffer.allocateDirect(3).put(CL.CL_CONTEXT_PLATFORM)
+ final long platform = pb.get(0);
+ final PointerBuffer properties = PointerBuffer.allocateDirect(3).put(CLContextBinding.CL_CONTEXT_PLATFORM)
.put(platform).put(0) // 0 terminated array
.rewind();
- long context = cl.clCreateContextFromType(properties, CL.CL_DEVICE_TYPE_ALL, null, null);
+ final long context = cl.clCreateContextFromType(properties, CLDeviceBinding.CL_DEVICE_TYPE_ALL, null, null);
out.println("context handle: "+context);
checkError("on clCreateContextFromType", ret);
- PointerBuffer longBuffer = PointerBuffer.allocateDirect(1);
- ret = cl.clGetContextInfo(context, CL.CL_CONTEXT_DEVICES, 0, null, longBuffer);
+ final PointerBuffer longBuffer = PointerBuffer.allocateDirect(1);
+ ret = cl.clGetContextInfo(context, CLContextBinding.CL_CONTEXT_DEVICES, 0, null, longBuffer);
checkError("on clGetContextInfo", ret);
- int deviceCount = (int) (longBuffer.get(0) / (is32Bit() ? 4 : 8));
+ final int deviceCount = (int) (longBuffer.get(0) / (is32Bit() ? 4 : 8));
out.println("context created with " + deviceCount + " devices");
// Was originally 4096, but had to make this bigger or it would crash in UITestCase.oneTimeTearDown(){ System.gc() }
// without even dumping a stack when using AMD drivers. Presumably the drivers would write past the end
// of the block and mess up GC info somehow.
- ByteBuffer bb = newDirectByteBuffer(32768);
- ret = cl.clGetContextInfo(context, CL.CL_CONTEXT_DEVICES, bb.capacity(), bb, null);
+ final ByteBuffer bb = newDirectByteBuffer(32768);
+ ret = cl.clGetContextInfo(context, CLContextBinding.CL_CONTEXT_DEVICES, bb.capacity(), bb, null);
checkError("on clGetContextInfo", ret);
for (int i = 0; i < deviceCount; i++) {
@@ -265,19 +270,19 @@ public class LowLevelBindingTest extends UITestCase {
int offset = new Random().nextInt(deviceCount);
out.println("using device# " + offset);
offset *= (is32Bit() ? 4 : 8);
- long device = is32Bit()?bb.getInt(offset):bb.getLong(offset);
+ final long device = is32Bit()?bb.getInt(offset):bb.getLong(offset);
bb.rewind();
- ret = cl.clGetDeviceInfo(device, CL.CL_DEVICE_MAX_WORK_GROUP_SIZE, bb.capacity(), bb, null);
+ ret = cl.clGetDeviceInfo(device, CLDeviceBinding.CL_DEVICE_MAX_WORK_GROUP_SIZE, bb.capacity(), bb, null);
checkError("on clGetDeviceInfo", ret);
- int maxWGS = bb.getInt();
+ final int maxWGS = bb.getInt();
out.println("max WGS: " + maxWGS);
// Create a command-queue
- long commandQueue = cl.clCreateCommandQueue(context, device, 0, intBuffer);
+ final long commandQueue = cl.clCreateCommandQueue(context, device, 0, intBuffer);
checkError("on clCreateCommandQueue", intBuffer.get(0));
- int localWorkSize = Math.min(128, maxWGS); // set and log Global and Local work size dimensions
+ final int localWorkSize = Math.min(128, maxWGS); // set and log Global and Local work size dimensions
int elementCount = ELEMENT_COUNT;
int globalWorkSize = 0;
@@ -296,7 +301,7 @@ public class LowLevelBindingTest extends UITestCase {
dest = newDirectByteBuffer(globalWorkSize*SIZEOF_INT);
allocated = true;
}
- catch( OutOfMemoryError oome ) {
+ catch( final OutOfMemoryError oome ) {
++divisor;
elementCount /= divisor;
out.println("not enough direct buffer memory; retrying with smaller buffers");
@@ -304,25 +309,25 @@ public class LowLevelBindingTest extends UITestCase {
}
// Allocate the OpenCL buffer memory objects for source and result on the device GMEM
- long devSrcA = cl.clCreateBuffer(context, CL.CL_MEM_READ_ONLY, srcA.capacity(), null, intBuffer);
+ final long devSrcA = cl.clCreateBuffer(context, CLMemObjBinding.CL_MEM_READ_ONLY, srcA.capacity(), null, intBuffer);
checkError("on clCreateBuffer", intBuffer.get(0));
- long devSrcB = cl.clCreateBuffer(context, CL.CL_MEM_READ_ONLY, srcB.capacity(), null, intBuffer);
+ final long devSrcB = cl.clCreateBuffer(context, CLMemObjBinding.CL_MEM_READ_ONLY, srcB.capacity(), null, intBuffer);
checkError("on clCreateBuffer", intBuffer.get(0));
- long devDst = cl.clCreateBuffer(context, CL.CL_MEM_WRITE_ONLY, dest.capacity(), null, intBuffer);
+ final long devDst = cl.clCreateBuffer(context, CLMemObjBinding.CL_MEM_WRITE_ONLY, dest.capacity(), null, intBuffer);
checkError("on clCreateBuffer", intBuffer.get(0));
// Create the program
- PointerBuffer lengths = PointerBuffer.allocateDirect(1).put(programSource.length()).rewind();
+ final PointerBuffer lengths = PointerBuffer.allocateDirect(1).put(programSource.length()).rewind();
final long program = cl.clCreateProgramWithSource(context, 1, new String[] {programSource}, lengths, intBuffer);
out.println("program id: "+program);
checkError("on clCreateProgramWithSource", intBuffer.get(0));
// tests if the callback is called
final CountDownLatch latch = new CountDownLatch(1);
- BuildProgramCallback callback = new BuildProgramCallback() {
+ final BuildProgramCallback callback = new BuildProgramCallback() {
@Override
- public void buildFinished(long cl_program) {
+ public void buildFinished(final long cl_program) {
try{
assertEquals(program, cl_program);
}finally{
@@ -344,40 +349,40 @@ public class LowLevelBindingTest extends UITestCase {
// Read program infos
bb.rewind();
- ret = cl.clGetProgramInfo(program, CL.CL_PROGRAM_NUM_DEVICES, bb.capacity(), bb, null);
+ ret = cl.clGetProgramInfo(program, CLProgramBinding.CL_PROGRAM_NUM_DEVICES, bb.capacity(), bb, null);
checkError("on clGetProgramInfo1", ret);
out.println("program associated with "+bb.getInt(0)+" device(s)");
- ret = cl.clGetProgramInfo(program, CL.CL_PROGRAM_SOURCE, 0, null, longBuffer);
+ ret = cl.clGetProgramInfo(program, CLProgramBinding.CL_PROGRAM_SOURCE, 0, null, longBuffer);
checkError("on clGetProgramInfo CL_PROGRAM_SOURCE", ret);
out.println("program source length (cl): "+longBuffer.get(0));
out.println("program source length (java): "+programSource.length());
bb.rewind();
- ret = cl.clGetProgramInfo(program, CL.CL_PROGRAM_SOURCE, bb.capacity(), bb, null);
+ ret = cl.clGetProgramInfo(program, CLProgramBinding.CL_PROGRAM_SOURCE, bb.capacity(), bb, null);
checkError("on clGetProgramInfo CL_PROGRAM_SOURCE", ret);
out.println("program source:\n" + clString2JavaString(bb, (int)longBuffer.get(0)));
// Check program status
bb.rewind();
- ret = cl.clGetProgramBuildInfo(program, device, CL.CL_PROGRAM_BUILD_STATUS, bb.capacity(), bb, null);
+ ret = cl.clGetProgramBuildInfo(program, device, CLProgramBinding.CL_PROGRAM_BUILD_STATUS, bb.capacity(), bb, null);
checkError("on clGetProgramBuildInfo1", ret);
out.println("program build status: " + CLProgram.Status.valueOf(bb.getInt(0)));
- assertEquals("build status", CL.CL_BUILD_SUCCESS, bb.getInt(0));
+ assertEquals("build status", CLProgramBinding.CL_BUILD_SUCCESS, bb.getInt(0));
// Read build log
- ret = cl.clGetProgramBuildInfo(program, device, CL.CL_PROGRAM_BUILD_LOG, 0, null, longBuffer);
+ ret = cl.clGetProgramBuildInfo(program, device, CLProgramBinding.CL_PROGRAM_BUILD_LOG, 0, null, longBuffer);
checkError("on clGetProgramBuildInfo2", ret);
out.println("program log length: " + longBuffer.get(0));
bb.rewind();
- ret = cl.clGetProgramBuildInfo(program, device, CL.CL_PROGRAM_BUILD_LOG, bb.capacity(), bb, null);
+ ret = cl.clGetProgramBuildInfo(program, device, CLProgramBinding.CL_PROGRAM_BUILD_LOG, bb.capacity(), bb, null);
checkError("on clGetProgramBuildInfo3", ret);
out.println("log:\n" + clString2JavaString(bb, (int)longBuffer.get(0)));
// Create the kernel
- long kernel = cl.clCreateKernel(program, "VectorAdd", intBuffer);
+ final long kernel = cl.clCreateKernel(program, "VectorAdd", intBuffer);
out.println("kernel id: "+kernel);
checkError("on clCreateKernel", intBuffer.get(0));
@@ -402,8 +407,8 @@ public class LowLevelBindingTest extends UITestCase {
checkError("on clEnqueueWriteBuffer", ret);
// Launch kernel
- PointerBuffer gWS = PointerBuffer.allocateDirect(1).put(globalWorkSize).rewind();
- PointerBuffer lWS = PointerBuffer.allocateDirect(1).put(localWorkSize).rewind();
+ final PointerBuffer gWS = PointerBuffer.allocateDirect(1).put(globalWorkSize).rewind();
+ final PointerBuffer lWS = PointerBuffer.allocateDirect(1).put(localWorkSize).rewind();
ret = cl.clEnqueueNDRangeKernel(commandQueue, kernel, 1, null, gWS, lWS, 0, null, null);
checkError("on clEnqueueNDRangeKernel", ret);
@@ -447,8 +452,8 @@ public class LowLevelBindingTest extends UITestCase {
//for memory leak detection; e.g watch out for "out of host memory" errors
out.println(" - - - loadTest - - - ");
- ExecutorService pool = Executors.newFixedThreadPool(8);
- List<Callable<Object>> tasks = new ArrayList<Callable<Object>>();
+ final ExecutorService pool = Executors.newFixedThreadPool(8);
+ final List<Callable<Object>> tasks = new ArrayList<Callable<Object>>();
for(int i = 0; i < 100; i++) {
final int n = i;
@@ -457,11 +462,11 @@ public class LowLevelBindingTest extends UITestCase {
public Object call() {
try {
out.println("###start iteration " + n);
- LowLevelBindingTest test = new LowLevelBindingTest();
+ final LowLevelBindingTest test = new LowLevelBindingTest();
test.ELEMENT_COUNT = 123456;
test.lowLevelVectorAddTest();
out.println("###end iteration " + n);
- } catch (InterruptedException ex) {
+ } catch (final InterruptedException ex) {
throw new RuntimeException(ex);
}
return null;
@@ -469,10 +474,10 @@ public class LowLevelBindingTest extends UITestCase {
});
}
- for (Future<Object> future : pool.invokeAll(tasks)) {
+ for (final Future<Object> future : pool.invokeAll(tasks)) {
try {
future.get();
- } catch (ExecutionException ex) {
+ } catch (final ExecutionException ex) {
ex.printStackTrace();
pool.shutdown();
fail();
@@ -482,21 +487,21 @@ public class LowLevelBindingTest extends UITestCase {
pool.awaitTermination(300, TimeUnit.SECONDS);
}
- private ByteBuffer wrap(long value) {
+ private ByteBuffer wrap(final long value) {
return (ByteBuffer) newDirectByteBuffer(8).putLong(value).rewind();
}
- private void checkForError(int ret) {
+ private void checkForError(final int ret) {
this.checkError("", ret);
}
- private void checkError(String msg, int ret) {
+ private void checkError(final String msg, final int ret) {
if(ret != CL.CL_SUCCESS)
throw CLException.newException(ret, msg);
}
- public static void main(String[] args) throws IOException {
- String tstname = LowLevelBindingTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = LowLevelBindingTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/test/com/jogamp/opencl/TestJoclVersion.java b/test/com/jogamp/opencl/TestJoclVersion.java
index 531ac343..45fd2e78 100644
--- a/test/com/jogamp/opencl/TestJoclVersion.java
+++ b/test/com/jogamp/opencl/TestJoclVersion.java
@@ -41,7 +41,7 @@ public class TestJoclVersion extends UITestCase {
@Test
public void testMain() throws InterruptedException {
- JoclVersion j = JoclVersion.getInstance();
+ final JoclVersion j = JoclVersion.getInstance();
System.out.println("Implementation-Version: "+j.getImplementationVersion());
System.out.println("Implementation-Build: "+j.getImplementationBuild());
System.out.println("Implementation-Branch: "+j.getImplementationBranch());
@@ -51,8 +51,8 @@ public class TestJoclVersion extends UITestCase {
}
- public static void main(String[] args) throws IOException {
- String tstname = TestJoclVersion.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = TestJoclVersion.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/test/com/jogamp/opencl/gl/CLGLTest.java b/test/com/jogamp/opencl/gl/CLGLTest.java
index 0d1a8c3f..62e2b2bb 100644
--- a/test/com/jogamp/opencl/gl/CLGLTest.java
+++ b/test/com/jogamp/opencl/gl/CLGLTest.java
@@ -57,9 +57,11 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
+import javax.media.opengl.GL;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLContext;
+import javax.media.opengl.fixedfunc.GLPointerFunc;
import org.junit.FixMethodOrder;
import org.junit.Test;
@@ -116,8 +118,10 @@ public class CLGLTest extends UITestCase {
initGL();
@SuppressWarnings("unchecked")
+ final
CLPlatform platform = CLPlatform.getDefault(CLPlatformFilters.glSharing());
@SuppressWarnings("unchecked")
+ final
CLDevice device = platform.getMaxFlopsDevice(CLDeviceFilters.glSharing());
if(device == null) {
@@ -133,7 +137,7 @@ public class CLGLTest extends UITestCase {
makeGLCurrent();
assertTrue(glcontext.isCurrent());
- CLContext context = CLGLContext.create(glcontext, device);
+ final CLContext context = CLGLContext.create(glcontext, device);
assertNotNull(context);
try{
@@ -162,6 +166,7 @@ public class CLGLTest extends UITestCase {
assertTrue(glcontext.isCurrent());
@SuppressWarnings("unchecked")
+ final
CLPlatform platform = CLPlatform.getDefault(glSharing(glcontext));
if(platform == null) {
out.println("test aborted");
@@ -169,40 +174,41 @@ public class CLGLTest extends UITestCase {
}
@SuppressWarnings("unchecked")
+ final
CLDevice theChosenOne = platform.getMaxFlopsDevice(CLDeviceFilters.glSharing());
out.println(theChosenOne);
- CLGLContext context = CLGLContext.create(glcontext, theChosenOne);
+ final CLGLContext context = CLGLContext.create(glcontext, theChosenOne);
try{
out.println(context);
- GL2 gl = glcontext.getGL().getGL2();
+ final GL2 gl = glcontext.getGL().getGL2();
- int[] id = new int[1];
+ final int[] id = new int[1];
gl.glGenBuffers(id.length, id, 0);
- IntBuffer glData = Buffers.newDirectIntBuffer(new int[] {0,1,2,3,4,5,6,7,8});
+ final IntBuffer glData = Buffers.newDirectIntBuffer(new int[] {0,1,2,3,4,5,6,7,8});
glData.rewind();
// create and write GL buffer
- gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
- gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, id[0]);
- gl.glBufferData(GL2.GL_ARRAY_BUFFER, glData.capacity()*4, glData, GL2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
- gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
+ gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ gl.glBindBuffer(GL.GL_ARRAY_BUFFER, id[0]);
+ gl.glBufferData(GL.GL_ARRAY_BUFFER, glData.capacity()*4, glData, GL.GL_STATIC_DRAW);
+ gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
+ gl.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
gl.glFinish();
// create CLGL buffer
- IntBuffer clData = Buffers.newDirectIntBuffer(9);
- CLGLBuffer<IntBuffer> clBuffer = context.createFromGLBuffer(clData, id[0], glData.capacity()*4, Mem.READ_ONLY);
+ final IntBuffer clData = Buffers.newDirectIntBuffer(9);
+ final CLGLBuffer<IntBuffer> clBuffer = context.createFromGLBuffer(clData, id[0], glData.capacity()*4, Mem.READ_ONLY);
assertEquals(glData.capacity(), clBuffer.getCLCapacity());
assertEquals(glData.capacity()*4, clBuffer.getCLSize());
- CLCommandQueue queue = theChosenOne.createCommandQueue();
+ final CLCommandQueue queue = theChosenOne.createCommandQueue();
// read gl buffer into cl nio buffer
queue.putAcquireGLObject(clBuffer)
@@ -238,52 +244,54 @@ public class CLGLTest extends UITestCase {
assertTrue(glcontext.isCurrent());
@SuppressWarnings("unchecked")
+ final
CLPlatform [] clplatforms = CLPlatform.listCLPlatforms(glSharing(glcontext));
if(clplatforms.length == 0) {
out.println("no platform that supports OpenGL-OpenCL interoperability");
return;
}
- for(CLPlatform clplatform : clplatforms) {
-
+ for(final CLPlatform clplatform : clplatforms) {
+
@SuppressWarnings("unchecked")
+ final
CLDevice [] cldevices = clplatform.listCLDevices(CLDeviceFilters.glSharing());
-
- for(CLDevice cldevice : cldevices) {
+
+ for(final CLDevice cldevice : cldevices) {
out.println(cldevice);
textureSharingInner(cldevice);
}
}
-
+
deinitGL();
}
- public void textureSharingInner(CLDevice cldevice) {
+ public void textureSharingInner(final CLDevice cldevice) {
- CLGLContext clglcontext = CLGLContext.create(glcontext, cldevice);
+ final CLGLContext clglcontext = CLGLContext.create(glcontext, cldevice);
try {
out.println(clglcontext);
- GL2 gl = glcontext.getGL().getGL2();
+ final GL2 gl = glcontext.getGL().getGL2();
// create and write GL texture
- int[] id = new int[1];
+ final int[] id = new int[1];
gl.glGenTextures(id.length, id, 0);
- gl.glActiveTexture(GL2.GL_TEXTURE0);
- gl.glBindTexture (GL2.GL_TEXTURE_2D, id[0]);
- int texWidth = 2;
- int texHeight = 2;
- gl.glTexImage2D(GL2.GL_TEXTURE_2D, 0, GL2.GL_RGBA, texWidth, texHeight, 0, GL2.GL_RGBA, GL2.GL_UNSIGNED_BYTE, null );
- gl.glBindTexture(GL2.GL_TEXTURE_2D, 0);
+ gl.glActiveTexture(GL.GL_TEXTURE0);
+ gl.glBindTexture (GL.GL_TEXTURE_2D, id[0]);
+ final int texWidth = 2;
+ final int texHeight = 2;
+ gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, texWidth, texHeight, 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, null );
+ gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
gl.glFinish();
// create CLGL buffer
- ByteBuffer bufferCL = Buffers.newDirectByteBuffer(texWidth*texHeight*4);
- CLGLTexture2d<ByteBuffer> clTexture = clglcontext.createFromGLTexture2d(bufferCL, GL2.GL_TEXTURE_2D, id[0], 0, CLBuffer.Mem.WRITE_ONLY);
+ final ByteBuffer bufferCL = Buffers.newDirectByteBuffer(texWidth*texHeight*4);
+ final CLGLTexture2d<ByteBuffer> clTexture = clglcontext.createFromGLTexture2d(bufferCL, GL.GL_TEXTURE_2D, id[0], 0, CLBuffer.Mem.WRITE_ONLY);
// set texel values to a formula that can be read back and verified
- String sourceCL = "__kernel void writeTexture (__write_only image2d_t imageTex, unsigned w, unsigned h ) \n" +
+ final String sourceCL = "__kernel void writeTexture (__write_only image2d_t imageTex, unsigned w, unsigned h ) \n" +
"{ \n" +
" for(unsigned y=1; y<=h; ++y) { \n" +
" for(unsigned x=1; x<=w; ++x) { \n" +
@@ -291,19 +299,19 @@ public class CLGLTest extends UITestCase {
" } \n" +
" } \n" +
"}";
- CLProgram program = clglcontext.createProgram(sourceCL);
+ final CLProgram program = clglcontext.createProgram(sourceCL);
program.build();
System.out.println(program.getBuildStatus());
System.out.println(program.getBuildLog());
assertTrue(program.isExecutable());
- CLKernel clkernel = program.createCLKernel("writeTexture")
+ final CLKernel clkernel = program.createCLKernel("writeTexture")
.putArg(clTexture)
.putArg(texWidth)
.putArg(texHeight)
.rewind();
- CLCommandQueue queue = cldevice.createCommandQueue();
+ final CLCommandQueue queue = cldevice.createCommandQueue();
// write gl texture with cl kernel, then read it to host buffer
queue.putAcquireGLObject(clTexture)
@@ -314,12 +322,12 @@ public class CLGLTest extends UITestCase {
for(int y = 1; y <= texHeight; y++) {
for(int x = 1; x <= texWidth; x++) {
- byte bX = bufferCL.get();
- byte bY = bufferCL.get();
- byte bZero = bufferCL.get();
- byte bMinusOne = bufferCL.get();
- byte bXCheck = (byte)(((float)x)/((float)(4*texWidth))*256);
- byte bYCheck = (byte)(((float)y)/((float)(4*texHeight))*256);
+ final byte bX = bufferCL.get();
+ final byte bY = bufferCL.get();
+ final byte bZero = bufferCL.get();
+ final byte bMinusOne = bufferCL.get();
+ final byte bXCheck = (byte)(((float)x)/((float)(4*texWidth))*256);
+ final byte bYCheck = (byte)(((float)y)/((float)(4*texHeight))*256);
assertEquals(bXCheck, bX);
assertEquals(bYCheck, bY);
assertEquals(0, bZero);
@@ -343,17 +351,17 @@ public class CLGLTest extends UITestCase {
try{
glcontext.makeCurrent();
break;
- }catch(RuntimeException ex) {
+ }catch(final RuntimeException ex) {
try {
Thread.sleep(200);
// I don't give up yet!
- } catch (InterruptedException ignore) { }
+ } catch (final InterruptedException ignore) { }
}
}
}
- public static void main(String[] args) throws IOException {
- String tstname = CLGLTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = CLGLTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/test/com/jogamp/opencl/test/util/MiscUtils.java b/test/com/jogamp/opencl/test/util/MiscUtils.java
index c91d8f21..85798a06 100644
--- a/test/com/jogamp/opencl/test/util/MiscUtils.java
+++ b/test/com/jogamp/opencl/test/util/MiscUtils.java
@@ -49,9 +49,9 @@ public class MiscUtils {
public final static int NUM_ELEMENTS = 10000000;
- public static final void fillBuffer(ByteBuffer buffer, int seed) {
+ public static final void fillBuffer(final ByteBuffer buffer, final int seed) {
- Random rnd = new Random(seed);
+ final Random rnd = new Random(seed);
while(buffer.remaining() != 0)
buffer.putInt(rnd.nextInt());
@@ -59,8 +59,8 @@ public class MiscUtils {
buffer.rewind();
}
- public static final int roundUp(int groupSize, int globalSize) {
- int r = globalSize % groupSize;
+ public static final int roundUp(final int groupSize, final int globalSize) {
+ final int r = globalSize % groupSize;
if (r == 0) {
return globalSize;
} else {
@@ -68,10 +68,10 @@ public class MiscUtils {
}
}
- public static final void checkIfEqual(ByteBuffer a, ByteBuffer b, int elements) {
+ public static final void checkIfEqual(final ByteBuffer a, final ByteBuffer b, final int elements) {
for(int i = 0; i < elements; i++) {
- int aVal = a.getInt();
- int bVal = b.getInt();
+ final int aVal = a.getInt();
+ final int bVal = b.getInt();
if(aVal != bVal) {
out.println("a: "+aVal);
out.println("b: "+bVal);
diff --git a/test/com/jogamp/opencl/test/util/UITestCase.java b/test/com/jogamp/opencl/test/util/UITestCase.java
index a5392ee9..b27f2061 100644
--- a/test/com/jogamp/opencl/test/util/UITestCase.java
+++ b/test/com/jogamp/opencl/test/util/UITestCase.java
@@ -79,7 +79,7 @@ public abstract class UITestCase {
return testSupported;
}
- public static void setTestSupported(boolean v) {
+ public static void setTestSupported(final boolean v) {
System.err.println("setTestSupported: "+v);
testSupported = v;
}
@@ -89,7 +89,7 @@ public abstract class UITestCase {
int ml = 0;
final TestClass tc = new TestClass(getClass());
final List<FrameworkMethod> testMethods = tc.getAnnotatedMethods(org.junit.Test.class);
- for(Iterator<FrameworkMethod> iter=testMethods.iterator(); iter.hasNext(); ) {
+ for(final Iterator<FrameworkMethod> iter=testMethods.iterator(); iter.hasNext(); ) {
final int l = iter.next().getName().length();
if( ml < l ) { ml = l; }
}
@@ -102,11 +102,11 @@ public abstract class UITestCase {
return _unitTestName.getMethodName();
}
- public final String getSimpleTestName(String separator) {
+ public final String getSimpleTestName(final String separator) {
return getClass().getSimpleName()+separator+getTestMethodName();
}
- public final String getFullTestName(String separator) {
+ public final String getFullTestName(final String separator) {
return getClass().getName()+separator+getTestMethodName();
}
@@ -146,12 +146,12 @@ public abstract class UITestCase {
System.err.println("++++ UITestCase.tearDown: "+getFullTestName(" - "));
}
- public static void waitForKey(String preMessage) {
- BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ public static void waitForKey(final String preMessage) {
+ final BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.err.println(preMessage+"> Press enter to continue");
try {
System.err.println(stdin.readLine());
- } catch (IOException e) { }
+ } catch (final IOException e) { }
}
static final String unsupportedTestMsg = "Test not supported on this platform.";
diff --git a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
index e1a59860..dea4c17d 100644
--- a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
+++ b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
@@ -49,19 +49,19 @@ public class CLMultiContextTest extends UITestCase {
@Test
public void createMultiContextTest() {
- CLMultiContext mc = CLMultiContext.create(CLPlatform.listCLPlatforms());
+ final CLMultiContext mc = CLMultiContext.create(CLPlatform.listCLPlatforms());
try{
- List<CLContext> contexts = mc.getContexts();
- List<CLDevice> devices = mc.getDevices();
+ final List<CLContext> contexts = mc.getContexts();
+ final List<CLDevice> devices = mc.getDevices();
assertFalse(contexts.isEmpty());
assertFalse(devices.isEmpty());
- for (CLContext context : contexts) {
+ for (final CLContext context : contexts) {
out.println(context);
}
- for (CLDevice device : devices) {
+ for (final CLDevice device : devices) {
out.println(device);
}
@@ -84,20 +84,20 @@ public class CLMultiContextTest extends UITestCase {
private final Buffer data;
- public CLTestTask(Buffer buffer) {
+ public CLTestTask(final Buffer buffer) {
this.data = buffer;
}
- public Buffer execute(CLSimpleQueueContext qc) {
+ public Buffer execute(final CLSimpleQueueContext qc) {
- CLCommandQueue queue = qc.getQueue();
- CLContext context = qc.getCLContext();
- CLKernel kernel = qc.getKernel("compute");
+ final CLCommandQueue queue = qc.getQueue();
+ final CLContext context = qc.getCLContext();
+ final CLKernel kernel = qc.getKernel("compute");
CLBuffer<Buffer> buffer = null;
try{
buffer = context.createBuffer(data);
- int gws = buffer.getCLCapacity();
+ final int gws = buffer.getCLCapacity();
kernel.putArg(buffer).putArg(gws).rewind();
@@ -118,12 +118,12 @@ public class CLMultiContextTest extends UITestCase {
@Test
public void commandQueuePoolTest() throws InterruptedException, ExecutionException {
- CLMultiContext mc = CLMultiContext.create(CLPlatform.listCLPlatforms());
+ final CLMultiContext mc = CLMultiContext.create(CLPlatform.listCLPlatforms());
try {
CLSimpleContextFactory factory = CLQueueContextFactory.createSimple(programSource);
- CLCommandQueuePool<CLSimpleQueueContext> pool = CLCommandQueuePool.create(factory, mc);
+ final CLCommandQueuePool<CLSimpleQueueContext> pool = CLCommandQueuePool.create(factory, mc);
assertTrue(pool.getSize() > 0);
@@ -131,12 +131,12 @@ public class CLMultiContextTest extends UITestCase {
final int tasksPerQueue = 10;
final int taskCount = pool.getSize() * tasksPerQueue;
- IntBuffer data = Buffers.newDirectIntBuffer(slice*taskCount);
+ final IntBuffer data = Buffers.newDirectIntBuffer(slice*taskCount);
- List<CLTestTask> tasks = new ArrayList<CLTestTask>(taskCount);
+ final List<CLTestTask> tasks = new ArrayList<CLTestTask>(taskCount);
for (int i = 0; i < taskCount; i++) {
- IntBuffer subBuffer = Buffers.slice(data, i*slice, slice);
+ final IntBuffer subBuffer = Buffers.slice(data, i*slice, slice);
assertEquals(slice, subBuffer.capacity());
tasks.add(new CLTestTask(subBuffer));
}
@@ -148,14 +148,14 @@ public class CLMultiContextTest extends UITestCase {
checkBuffer(1, data);
// submit blocking emediatly
- for (CLTestTask task : tasks) {
+ for (final CLTestTask task : tasks) {
pool.submit(task).get();
}
checkBuffer(2, data);
// submitAll using futures
- List<Future<Buffer>> futures = pool.submitAll(tasks);
- for (Future<Buffer> future : futures) {
+ final List<Future<Buffer>> futures = pool.submitAll(tasks);
+ for (final Future<Buffer> future : futures) {
future.get();
}
checkBuffer(3, data);
@@ -172,15 +172,15 @@ public class CLMultiContextTest extends UITestCase {
}
}
- private void checkBuffer(int expected, IntBuffer data) {
+ private void checkBuffer(final int expected, final IntBuffer data) {
while(data.hasRemaining()) {
assertEquals(expected, data.get());
}
data.rewind();
}
- public static void main(String[] args) throws IOException {
- String tstname = CLMultiContextTest.class.getName();
+ public static void main(final String[] args) throws IOException {
+ final String tstname = CLMultiContextTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}