summaryrefslogtreecommitdiffstats
path: root/test/com/jogamp/opencl/HighLevelBindingTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/com/jogamp/opencl/HighLevelBindingTest.java')
-rw-r--r--test/com/jogamp/opencl/HighLevelBindingTest.java31
1 files changed, 24 insertions, 7 deletions
diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java
index 6a003435..a0a67595 100644
--- a/test/com/jogamp/opencl/HighLevelBindingTest.java
+++ b/test/com/jogamp/opencl/HighLevelBindingTest.java
@@ -167,6 +167,7 @@ public class HighLevelBindingTest extends UITestCase {
// out.println(" C version: "+device.getCVersion()); //CL 1.1
out.println(" driver version: "+device.getDriverVersion());
out.println(" type: "+device.getType());
+ out.println(" mem base addr align: "+device.getMemBaseAddrAlign());
out.println(" global mem: "+device.getGlobalMemSize()/(1024*1024)+" MB");
out.println(" max alloc mem: "+device.getMaxMemAllocSize()/(1024*1024)+" MB");
out.println(" max param size: "+device.getMaxParameterSize()+" byte");
@@ -323,13 +324,29 @@ public class HighLevelBindingTest extends UITestCase {
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
-
- out.println("allocateing buffers of size: "+globalWorkSize);
-
- ByteBuffer srcA = newDirectByteBuffer(globalWorkSize*SIZEOF_INT);
- ByteBuffer srcB = newDirectByteBuffer(globalWorkSize*SIZEOF_INT);
- ByteBuffer dest = newDirectByteBuffer(globalWorkSize*SIZEOF_INT);
+ int globalWorkSize = 0;
+
+ ByteBuffer srcA = null;
+ ByteBuffer srcB = null;
+ ByteBuffer dest = null;
+ boolean allocated = false;
+ int divisor = 1;
+ while( !allocated ) {
+ try {
+ // round up to the nearest multiple of the LocalWorkSize
+ globalWorkSize = roundUp(localWorkSize, elementCount);
+ out.println("allocating three buffers of size: "+globalWorkSize);
+ srcA = newDirectByteBuffer(globalWorkSize*SIZEOF_INT);
+ srcB = newDirectByteBuffer(globalWorkSize*SIZEOF_INT);
+ dest = newDirectByteBuffer(globalWorkSize*SIZEOF_INT);
+ allocated = true;
+ }
+ catch( OutOfMemoryError oome ) {
+ ++divisor;
+ elementCount /= divisor;
+ out.println("not enough direct buffer memory; retrying with smaller buffers");
+ }
+ }
fillBuffer(srcA, 23456);
fillBuffer(srcB, 46987);