diff options
author | Michael Bien <[email protected]> | 2010-02-24 02:06:34 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-02-24 02:06:34 +0100 |
commit | 01775d5597d6d1ef4fff195f572c1a6528438f66 (patch) | |
tree | 5868fed2cce5addd388bffb729590b28b94d0196 | |
parent | d78faf0ef678cc87f5220d2cb8eccbe173449541 (diff) |
code review. Fixed typos in javadoc and fixed some warnings.
-rw-r--r-- | src/com/mbien/opencl/CLCommandQueue.java | 25 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLContext.java | 26 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLEvent.java | 4 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLException.java | 4 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLGLContext.java | 10 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLKernel.java | 12 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLMemory.java | 12 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLPlatform.java | 10 | ||||
-rw-r--r-- | src/com/mbien/opencl/CLProgram.java | 6 | ||||
-rw-r--r-- | src/com/mbien/opencl/QueueBarrier.java | 2 |
10 files changed, 49 insertions, 62 deletions
diff --git a/src/com/mbien/opencl/CLCommandQueue.java b/src/com/mbien/opencl/CLCommandQueue.java index ce15e715..269b0e6e 100644 --- a/src/com/mbien/opencl/CLCommandQueue.java +++ b/src/com/mbien/opencl/CLCommandQueue.java @@ -18,7 +18,7 @@ import static com.mbien.opencl.CLUtils.*; * not being shared.<br/> * Sharing of objects across multiple queues or using a CLCommandQueue * form multiple Threads will require the application to perform appropriate synchronization. - * @see CLDevice#createCommandQueue(com.mbien.opencl.CLCommandQueue.Mode[]) + * @see CLDevice#createCommandQueue(com.mbien.opencl.CLCommandQueue.Mode...) * @author Michael Bien */ public class CLCommandQueue extends CLObject implements CLResource { @@ -97,21 +97,6 @@ public class CLCommandQueue extends CLObject implements CLResource { return this; } -/* - public CLCommandQueue putReadBuffer(CLBuffer<?> readBuffer, Buffer buffer, boolean blockingRead) { - - int ret = cl.clEnqueueReadBuffer( - ID, readBuffer.ID, blockingRead ? CL_TRUE : CL_FALSE, - 0, readBuffer.getSizeInBytes(), buffer, -// 0, null, null); //TODO solve NPE in gluegen when PointerBuffer == null (fast dircet memory path) - 0, null, 0, null, 0); //TODO events - - if(ret != CL_SUCCESS) - throw new CLException(ret, "can not enqueue ReadBuffer: " + readBuffer); - - return this; - } -*/ public CLCommandQueue putCopyBuffer(CLBuffer<?> src, CLBuffer<?> dest) { return putCopyBuffer(src, dest, 0, 0, src.getCLSize(), null); @@ -620,7 +605,7 @@ public class CLCommandQueue extends CLObject implements CLResource { } /** - * {@link #putTask} equivalent to calling + * Equivalent to calling * {@link #put1DRangeKernel(CLKernel kernel, long globalWorkOffset, long globalWorkSize, long localWorkSize)} * with globalWorkOffset = null, globalWorkSize set to 1, and localWorkSize set to 1. */ @@ -794,15 +779,15 @@ public class CLCommandQueue extends CLObject implements CLResource { checkForError(ret, "can not release command queue"); } - private final static PointerBuffer copy2NIO(PointerBuffer buffer, long a) { + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a) { return buffer.put(2, a).position(2); } - private final static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b) { + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b) { return buffer.position(1).put(a).put(b).position(1); } - private final static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b, long c) { + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b, long c) { return buffer.rewind().put(a).put(b).put(c).rewind(); } diff --git a/src/com/mbien/opencl/CLContext.java b/src/com/mbien/opencl/CLContext.java index 505e4f73..68c391f1 100644 --- a/src/com/mbien/opencl/CLContext.java +++ b/src/com/mbien/opencl/CLContext.java @@ -56,7 +56,7 @@ public class CLContext extends CLObject implements CLResource { this.queuesMap = new HashMap<CLDevice, List<CLCommandQueue>>(); } - private final void initDevices() { + private void initDevices() { if (devices == null) { @@ -81,7 +81,7 @@ public class CLContext extends CLObject implements CLResource { * Creates a context on all available devices (CL_DEVICE_TYPE_ALL). * The platform to be used is implementation dependent. */ - public static final CLContext create() { + public static CLContext create() { return create((CLPlatform)null, Type.ALL); } @@ -89,7 +89,7 @@ public class CLContext extends CLObject implements CLResource { * Creates a context on the specified device types. * The platform to be used is implementation dependent. */ - public static final CLContext create(CLDevice.Type... deviceTypes) { + public static CLContext create(CLDevice.Type... deviceTypes) { return create(null, deviceTypes); } @@ -97,14 +97,14 @@ public class CLContext extends CLObject implements CLResource { * Creates a context on the specified devices. * The platform to be used is implementation dependent. */ - public static final CLContext create(CLDevice... devices) { + public static CLContext create(CLDevice... devices) { return create(null, devices); } /** * Creates a context on the specified platform on all available devices (CL_DEVICE_TYPE_ALL). */ - public static final CLContext create(CLPlatform platform) { + public static CLContext create(CLPlatform platform) { return create(platform, CLDevice.Type.ALL); } @@ -112,7 +112,7 @@ public class CLContext extends CLObject implements CLResource { * Creates a context on the specified platform and with the specified * device types. */ - public static final CLContext create(CLPlatform platform, CLDevice.Type... deviceTypes) { + public static CLContext create(CLPlatform platform, CLDevice.Type... deviceTypes) { if(platform == null) { platform = CLPlatform.getDefault(); @@ -128,7 +128,7 @@ public class CLContext extends CLObject implements CLResource { * Creates a context on the specified platform and with the specified * devices. */ - public static final CLContext create(CLPlatform platform, CLDevice... devices) { + public static CLContext create(CLPlatform platform, CLDevice... devices) { if(platform == null) { platform = CLPlatform.getDefault(); @@ -144,7 +144,7 @@ public class CLContext extends CLObject implements CLResource { return context; } - protected static final long createContextFromType(PointerBuffer properties, long deviceType) { + protected static long createContextFromType(PointerBuffer properties, long deviceType) { IntBuffer status = IntBuffer.allocate(1); long context = CLPlatform.getLowLevelCLInterface().clCreateContextFromType(properties, deviceType, null, null, status); @@ -154,7 +154,7 @@ public class CLContext extends CLObject implements CLResource { return context; } - protected static final long createContext(PointerBuffer properties, CLDevice... devices) { + protected static long createContext(PointerBuffer properties, CLDevice... devices) { IntBuffer status = BufferFactory.newDirectByteBuffer(4).asIntBuffer(); PointerBuffer pb = null; @@ -171,7 +171,7 @@ public class CLContext extends CLObject implements CLResource { return context; } - private static final PointerBuffer setupContextProperties(CLPlatform platform) { + private static PointerBuffer setupContextProperties(CLPlatform platform) { if(platform == null) { throw new RuntimeException("no OpenCL installation found"); @@ -216,10 +216,10 @@ public class CLContext extends CLObject implements CLResource { /** * Creates a program from the given binaries, the program is not build yet. - * <br/>Creating a programm will fail if:<br/> + * <br/>Creating a program will fail if:<br/> * <ul> * <li>the submitted binaries are invalid or can not be loaded from the OpenCL driver</li> - * <li>the binaries do not fitt to the CLDevices associated with this context</li> + * <li>the binaries do not fit to the CLDevices associated with this context</li> * <li>binaries are missing for one or more CLDevices</li> * </ul> */ @@ -414,7 +414,7 @@ public class CLContext extends CLObject implements CLResource { /** * Returns the device with maximal FLOPS from this context. - * The device speed is estimated by calulating the product of + * The device speed is estimated by calculating the product of * MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY. * @see #getMaxFlopsDevice(com.mbien.opencl.CLDevice.Type) */ diff --git a/src/com/mbien/opencl/CLEvent.java b/src/com/mbien/opencl/CLEvent.java index bcc59efc..fb0af13f 100644 --- a/src/com/mbien/opencl/CLEvent.java +++ b/src/com/mbien/opencl/CLEvent.java @@ -8,7 +8,7 @@ import static com.mbien.opencl.CLException.*; /** * Event objects can be used for synchronizing command queues, e.g you can wait until a - * event accures or they can also be used to capture profiling information that + * event occurs or they can also be used to capture profiling information that * measure execution time of a command. * Profiling of OpenCL commands can be enabled by using a {@link com.mbien.opencl.CLCommandQueue} created with * {@link com.mbien.opencl.CLCommandQueue.Mode#PROFILING_MODE}. @@ -190,7 +190,7 @@ public class CLEvent extends CLObject implements CLResource { /** - * Value of wrapped OpenCL command excecution status. + * Value of wrapped OpenCL command execution status. */ public final int STATUS; diff --git a/src/com/mbien/opencl/CLException.java b/src/com/mbien/opencl/CLException.java index 2f6a02a4..baa187a5 100644 --- a/src/com/mbien/opencl/CLException.java +++ b/src/com/mbien/opencl/CLException.java @@ -32,7 +32,7 @@ public class CLException extends RuntimeException { /** * Throws a CLException when <code>status != CL_SUCCESS</code>. */ - public static final void checkForError(int status, String message) { + public static void checkForError(int status, String message) { if(status != CL_SUCCESS) { CLException ex = newException(status, message); ex.fillInStackTrace(); @@ -43,7 +43,7 @@ public class CLException extends RuntimeException { /** * Returns a CLException specific to the error code. */ - public static final CLException newException(int status, String message) { + public static CLException newException(int status, String message) { CLException specificEx = createSpecificException(status, message); if(specificEx != null) { specificEx.fillInStackTrace(); diff --git a/src/com/mbien/opencl/CLGLContext.java b/src/com/mbien/opencl/CLGLContext.java index 46f0dea3..e10ae6e7 100644 --- a/src/com/mbien/opencl/CLGLContext.java +++ b/src/com/mbien/opencl/CLGLContext.java @@ -28,7 +28,7 @@ public final class CLGLContext extends CLContext { /** * Creates a shared context on all available devices (CL_DEVICE_TYPE_ALL). */ - public static final CLGLContext create(GLContext glContext) { + public static CLGLContext create(GLContext glContext) { return create(glContext, (CLPlatform)null, CLDevice.Type.ALL); } @@ -51,7 +51,7 @@ public final class CLGLContext extends CLContext { * Creates a shared context on the specified devices. * The platform to be used is implementation dependent. */ - public static final CLGLContext create(GLContext glContext, CLDevice... devices) { + public static CLGLContext create(GLContext glContext, CLDevice... devices) { return create(glContext, null, devices); } @@ -59,7 +59,7 @@ public final class CLGLContext extends CLContext { * Creates a shared context on the specified platform and with the specified * device types. */ - public static final CLGLContext create(GLContext glContext, CLPlatform platform, CLDevice.Type... deviceTypes) { + public static CLGLContext create(GLContext glContext, CLPlatform platform, CLDevice.Type... deviceTypes) { if(platform == null) { platform = CLPlatform.getDefault(); @@ -77,7 +77,7 @@ public final class CLGLContext extends CLContext { * Creates a shared context on the specified platform and with the specified * devices. */ - public static final CLGLContext create(GLContext glContext, CLPlatform platform, CLDevice... devices) { + public static CLGLContext create(GLContext glContext, CLPlatform platform, CLDevice... devices) { if(platform == null) { platform = CLPlatform.getDefault(); @@ -97,7 +97,7 @@ public final class CLGLContext extends CLContext { } - private static final PointerBuffer setupContextProperties(CLPlatform platform, GLContext glContext, long[] glID) { + private static PointerBuffer setupContextProperties(CLPlatform platform, GLContext glContext, long[] glID) { if(platform == null) { throw new RuntimeException("no OpenCL installation found"); diff --git a/src/com/mbien/opencl/CLKernel.java b/src/com/mbien/opencl/CLKernel.java index a4573a01..1ba84d1c 100644 --- a/src/com/mbien/opencl/CLKernel.java +++ b/src/com/mbien/opencl/CLKernel.java @@ -131,13 +131,13 @@ public class CLKernel extends CLObject implements CLResource, Cloneable { return this; } - private final void setArgs(int startIndex, CLMemory<?>... values) { + private void setArgs(int startIndex, CLMemory<?>... values) { for (int i = 0; i < values.length; i++) { setArg(i+startIndex, values[i]); } } - private final void setArgument(int argumentIndex, int size, Buffer value) { + private void setArgument(int argumentIndex, int size, Buffer value) { if(argumentIndex >= numArgs || argumentIndex < 0) { throw new IndexOutOfBoundsException("kernel "+ toString() +" has "+numArgs+ " arguments, can not set argument with index "+argumentIndex); @@ -171,19 +171,19 @@ public class CLKernel extends CLObject implements CLResource, Cloneable { return force32BitArgs; } - private final Buffer wrap(float value) { + private Buffer wrap(float value) { return buffer.putFloat(value).rewind(); } - private final Buffer wrap(double value) { + private Buffer wrap(double value) { return buffer.putDouble(value).rewind(); } - private final Buffer wrap(int value) { + private Buffer wrap(int value) { return buffer.putInt(value).rewind(); } - private final Buffer wrap(long value) { + private Buffer wrap(long value) { return buffer.putLong(value).rewind(); } diff --git a/src/com/mbien/opencl/CLMemory.java b/src/com/mbien/opencl/CLMemory.java index 59537f85..28de48ed 100644 --- a/src/com/mbien/opencl/CLMemory.java +++ b/src/com/mbien/opencl/CLMemory.java @@ -32,12 +32,12 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL /** * Returns true if a host pointer must be specified on mem object creation. */ - protected static final boolean isHostPointerFlag(int flags) { + protected static boolean isHostPointerFlag(int flags) { return (flags & CL_MEM_COPY_HOST_PTR) != 0 || (flags & CL_MEM_USE_HOST_PTR) != 0; } - protected static final int sizeOfBufferElem(Buffer buffer) { + protected static int sizeOfBufferElem(Buffer buffer) { if (buffer instanceof ByteBuffer) { return BufferFactory.SIZEOF_BYTE; } else if (buffer instanceof IntBuffer) { @@ -175,7 +175,7 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL * Enum representing CL_MEM_ALLOC_HOST_PTR. * This flag specifies that the application wants the OpenCL implementation * to allocate memory from host accessible memory. - * {@link #ALLOC_HOST_PTR} and {@link #USE_BUFFER} are mutually exclusive. + * {@link #ALLOCATE_BUFFER} and {@link #USE_BUFFER} are mutually exclusive. */ ALLOCATE_BUFFER(CL_MEM_ALLOC_HOST_PTR), @@ -230,8 +230,10 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL } /** - * Configures the mapping process of - * {@link com.mbien.opencl.CLCommandQueue#putMapBuffer(CLBuffer, CLMemory.Map, boolean)}. + * Configures the mapping process. + * @see com.mbien.opencl.CLCommandQueue#putMapBuffer(CLBuffer, com.mbien.opencl.CLMemory.Map, boolean). + * @see com.mbien.opencl.CLCommandQueue#putMapImage(CLImage2d, com.mbien.opencl.CLMemory.Map, boolean) + * @see com.mbien.opencl.CLCommandQueue#putMapImage(CLImage3d, com.mbien.opencl.CLMemory.Map, boolean) */ public enum Map { diff --git a/src/com/mbien/opencl/CLPlatform.java b/src/com/mbien/opencl/CLPlatform.java index 687cf130..ddca7d38 100644 --- a/src/com/mbien/opencl/CLPlatform.java +++ b/src/com/mbien/opencl/CLPlatform.java @@ -50,7 +50,7 @@ public final class CLPlatform { } /** - * Lists all available OpenCL implementaitons. + * Lists all available OpenCL implementations. * @throws CLException if something went wrong initializing OpenCL */ public static CLPlatform[] listCLPlatforms() { @@ -128,11 +128,11 @@ public final class CLPlatform { } - static final CLDevice findMaxFlopsDevice(CLDevice[] devices) { + static CLDevice findMaxFlopsDevice(CLDevice[] devices) { return findMaxFlopsDevice(devices, null); } - static final CLDevice findMaxFlopsDevice(CLDevice[] devices, CLDevice.Type type) { + static CLDevice findMaxFlopsDevice(CLDevice[] devices, CLDevice.Type type) { CLDevice maxFLOPSDevice = null; @@ -162,7 +162,7 @@ public final class CLPlatform { /** * Returns the device with maximal FLOPS from this platform. - * The device speed is estimated by calulating the product of + * The device speed is estimated by calculating the product of * MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY. * @see #getMaxFlopsDevice(com.mbien.opencl.CLDevice.Type) */ @@ -172,7 +172,7 @@ public final class CLPlatform { /** * Returns the device with maximal FLOPS and the specified type from this platform. - * The device speed is estimated by calulating the product of + * The device speed is estimated by calculating the product of * MAX_COMPUTE_UNITS and MAX_CLOCK_FREQUENCY. */ public CLDevice getMaxFlopsDevice(CLDevice.Type type) { diff --git a/src/com/mbien/opencl/CLProgram.java b/src/com/mbien/opencl/CLProgram.java index 4c3d61f5..829809de 100644 --- a/src/com/mbien/opencl/CLProgram.java +++ b/src/com/mbien/opencl/CLProgram.java @@ -83,7 +83,7 @@ public class CLProgram extends CLObject implements CLResource { return new CLProgram(context, id); } - private final void initBuildStatus() { + private void initBuildStatus() { if(buildStatusMap == null) { Map<CLDevice, Status> map = new HashMap<CLDevice, Status>(); @@ -99,7 +99,7 @@ public class CLProgram extends CLObject implements CLResource { } } - private final String getBuildInfoString(long device, int flag) { + private String getBuildInfoString(long device, int flag) { if(released) { return ""; @@ -118,7 +118,7 @@ public class CLProgram extends CLObject implements CLResource { return CLUtils.clString2JavaString(bb, (int)pb.get(0)); } - private final String getProgramInfoString(int flag) { + private String getProgramInfoString(int flag) { if(released) { return ""; diff --git a/src/com/mbien/opencl/QueueBarrier.java b/src/com/mbien/opencl/QueueBarrier.java index 37c5d3f1..fc166070 100644 --- a/src/com/mbien/opencl/QueueBarrier.java +++ b/src/com/mbien/opencl/QueueBarrier.java @@ -76,7 +76,7 @@ public class QueueBarrier { return this; } - private final void checkQueue(CLCommandQueue queue) throws IllegalArgumentException { + private void checkQueue(CLCommandQueue queue) throws IllegalArgumentException { if (queues != null && !queues.contains(queue)) { throw new IllegalArgumentException(queue + " is not in the allowedQueues Set: " + queues); } |