diff options
author | Michael Bien <[email protected]> | 2009-10-19 02:56:04 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-10-19 02:56:04 +0200 |
commit | 9abfd00399e4ca5c351df9cdf25cd85c960b3d44 (patch) | |
tree | 0b44ac0da5c03fdd08a4039b25238c240bda1857 /src/com/mbien/opencl/CLPlatform.java | |
parent | 01ae874925c4471d76ee6b18f15bf201c6f12f48 (diff) |
initial import of CLProgram. Updated JUnit Test accordingly.
Diffstat (limited to 'src/com/mbien/opencl/CLPlatform.java')
-rw-r--r-- | src/com/mbien/opencl/CLPlatform.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/com/mbien/opencl/CLPlatform.java b/src/com/mbien/opencl/CLPlatform.java index 252872dc..a717564a 100644 --- a/src/com/mbien/opencl/CLPlatform.java +++ b/src/com/mbien/opencl/CLPlatform.java @@ -1,7 +1,7 @@ package com.mbien.opencl; import java.nio.ByteBuffer; - +import static com.mbien.opencl.CLException.*; /** * * @author Michael Bien @@ -29,13 +29,11 @@ public final class CLPlatform { //find all devices int ret = cl.clGetDeviceIDs(platformID, CL.CL_DEVICE_TYPE_ALL, 0, null, 0, intBuffer, 0); - if(CL.CL_SUCCESS != ret) - throw new CLException(ret, "error while enumerating devices"); + checkForError(ret, "error while enumerating devices"); long[] deviceIDs = new long[intBuffer[0]]; ret = cl.clGetDeviceIDs(platformID, CL.CL_DEVICE_TYPE_ALL, deviceIDs.length, deviceIDs, 0, null, 0); - if(CL.CL_SUCCESS != ret) - throw new CLException(ret, "error while enumerating devices"); + checkForError(ret, "error while enumerating devices"); CLDevice[] devices = new CLDevice[deviceIDs.length]; @@ -83,8 +81,7 @@ public final class CLPlatform { ByteBuffer bb = ByteBuffer.allocate(512); int ret = cl.clGetPlatformInfo(platformID, key, bb.capacity(), bb, longBuffer, 0); - if(CL.CL_SUCCESS != ret) - throw new CLException(ret, "can not receive info string"); + checkForError(ret, "can not receive info string"); return new String(bb.array(), 0, (int)longBuffer[0]); } |