From 9abfd00399e4ca5c351df9cdf25cd85c960b3d44 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Mon, 19 Oct 2009 02:56:04 +0200 Subject: initial import of CLProgram. Updated JUnit Test accordingly. --- src/com/mbien/opencl/CLDevice.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/com/mbien/opencl/CLDevice.java') diff --git a/src/com/mbien/opencl/CLDevice.java b/src/com/mbien/opencl/CLDevice.java index ba20f4b2..d9f643ce 100644 --- a/src/com/mbien/opencl/CLDevice.java +++ b/src/com/mbien/opencl/CLDevice.java @@ -7,6 +7,8 @@ import java.util.HashSet; import java.util.Scanner; import java.util.Set; +import static com.mbien.opencl.CLException.*; + /** * * @author Michael Bien @@ -34,7 +36,7 @@ public final class CLDevice { */ DEFAULT(CL.CL_DEVICE_TYPE_DEFAULT); - /** + /** * Value of wrapped OpenCL device type. */ public final int CL_TYPE; @@ -160,8 +162,7 @@ public final class CLDevice { int ret = cl.clGetDeviceInfo(deviceID, key, bb.capacity(), bb, null, 0); - if(CL.CL_SUCCESS != ret) - throw new CLException(ret, "can not receive device info"); + checkForError(ret, "can not receive device info"); return bb.getLong(); } @@ -173,8 +174,7 @@ public final class CLDevice { int ret = cl.clGetDeviceInfo(deviceID, key, bb.capacity(), bb, longBuffer, 0); - if(CL.CL_SUCCESS != ret) - throw new CLException(ret, "can not receive device info string"); + checkForError(ret, "can not receive device info string"); return new String(bb.array(), 0, (int)longBuffer[0]); @@ -183,9 +183,10 @@ public final class CLDevice { @Override public String toString() { - return "CLPlatform [name:" + getName() - + " type:" + getType() - + " profile: " + getProfile()+"]"; + return "CLDevice [id: " + deviceID + + " name: " + getName() + + " type: " + getType() + + " profile: " + getProfile()+"]"; } @Override -- cgit v1.2.3