|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jogamp.opencl.CLContext
public class CLContext
CLContext is responsible for managing objects such as command-queues, memory, program and kernel objects and for executing kernels on one or more devices specified in the context.
Must be released if no longer used to free native resources. release()
will
also free all associated CLResource
like programs, samplers, command queues and memory
objects.
For a code example see CLPlatform
.
Nested Class Summary | |
---|---|
protected static class |
CLContext.ErrorDispatcher
|
Field Summary | |
---|---|
protected CL |
cl
|
protected CLContext |
context
|
protected CLDevice[] |
devices
|
long |
ID
The OpenCL object handle. |
protected Set<CLMemory<? extends Buffer>> |
memoryObjects
|
protected CLPlatform |
platform
|
protected Set<CLProgram> |
programs
|
protected Map<CLDevice,List<CLCommandQueue>> |
queuesMap
|
protected Set<CLSampler> |
samplers
|
Constructor Summary | |
---|---|
protected |
CLContext(CLPlatform platform,
long contextID,
CLContext.ErrorDispatcher dispatcher)
|
Method Summary | ||
---|---|---|
void |
addCLErrorHandler(CLErrorHandler handler)
|
|
void |
close()
Deprecated. This method is not intended to be called from client code. |
|
static CLContext |
create()
Creates a context on all available devices (CL_DEVICE_TYPE_ALL). |
|
static CLContext |
create(CLDevice... devices)
Creates a context on the specified devices. |
|
static CLContext |
create(CLDevice.Type... deviceTypes)
Creates a context on the specified device types. |
|
static CLContext |
create(CLPlatform platform)
Creates a context on the specified platform on all available devices (CL_DEVICE_TYPE_ALL). |
|
static CLContext |
create(CLPlatform platform,
CLDevice.Type... deviceTypes)
Creates a context on the specified platform and with the specified device types. |
|
|
createBuffer(B directBuffer,
CLMemory.Mem... flags)
Creates a CLBuffer with the specified flags. |
|
|
createBuffer(B directBuffer,
int flags)
Creates a CLBuffer with the specified flags. |
|
CLBuffer<?> |
createBuffer(int size,
CLMemory.Mem... flags)
Creates a CLBuffer with the specified flags. |
|
CLBuffer<?> |
createBuffer(int size,
int flags)
Creates a CLBuffer with the specified flags. |
|
CLBuffer<ByteBuffer> |
createByteBuffer(int size,
CLMemory.Mem... flags)
Creates a CLBuffer with the specified flags and buffer size in bytes. |
|
CLBuffer<ByteBuffer> |
createByteBuffer(int size,
int flags)
Creates a CLBuffer with the specified flags and buffer size in bytes. |
|
protected static long |
createContext(CLErrorHandler handler,
PointerBuffer properties,
CLDevice... devices)
|
|
protected static long |
createContextFromType(CLErrorHandler handler,
PointerBuffer properties,
long deviceType)
|
|
CLBuffer<DoubleBuffer> |
createDoubleBuffer(int size,
CLMemory.Mem... flags)
Creates a CLBuffer with the specified flags and element count. |
|
protected static CLContext.ErrorDispatcher |
createErrorHandler()
|
|
CLBuffer<FloatBuffer> |
createFloatBuffer(int size,
CLMemory.Mem... flags)
Creates a CLBuffer with the specified flags and element count. |
|
|
createImage2d(B directBuffer,
int width,
int height,
CLImageFormat format,
CLMemory.Mem... flags)
Creates a CLImage2d with the specified format, dimension and flags. |
|
|
createImage2d(B directBuffer,
int width,
int height,
int rowPitch,
CLImageFormat format,
CLMemory.Mem... flags)
Creates a CLImage2d with the specified format, dimension and flags. |
|
CLImage2d<?> |
createImage2d(int width,
int height,
CLImageFormat format,
CLMemory.Mem... flags)
Creates a CLImage2d with the specified format, dimension and flags. |
|
CLImage2d<?> |
createImage2d(int width,
int height,
int rowPitch,
CLImageFormat format,
CLMemory.Mem... flags)
Creates a CLImage2d with the specified format, dimension and flags. |
|
|
createImage3d(B directBuffer,
int width,
int height,
int depth,
CLImageFormat format,
CLMemory.Mem... flags)
Creates a CLImage3d with the specified format, dimension and flags. |
|
|
createImage3d(B directBuffer,
int width,
int height,
int depth,
int rowPitch,
int slicePitch,
CLImageFormat format,
CLMemory.Mem... flags)
Creates a CLImage3d with the specified format, dimension and flags. |
|
CLImage3d<?> |
createImage3d(int width,
int height,
CLImageFormat format,
CLMemory.Mem... flags)
Creates a CLImage3d with the specified format, dimension and flags. |
|
CLImage3d<?> |
createImage3d(int width,
int height,
int depth,
int rowPitch,
CLImageFormat format,
CLMemory.Mem... flags)
Creates a CLImage3d with the specified format, dimension and flags. |
|
CLBuffer<IntBuffer> |
createIntBuffer(int size,
CLMemory.Mem... flags)
Creates a CLBuffer with the specified flags and element count. |
|
CLBuffer<LongBuffer> |
createLongBuffer(int size,
CLMemory.Mem... flags)
Creates a CLBuffer with the specified flags and element count. |
|
CLProgram |
createProgram(InputStream source)
Creates a program and reads the source from stream, the program is not build yet. |
|
CLProgram |
createProgram(Map<CLDevice,byte[]> binaries)
Creates a program from the given binaries, the program is not build yet. |
|
CLProgram |
createProgram(String src)
Creates a program from the given sources, the program is not build yet. |
|
CLSampler |
createSampler(CLSampler.AddressingMode addrMode,
CLSampler.FilteringMode filtMode,
boolean normalizedCoords)
|
|
CLBuffer<ShortBuffer> |
createShortBuffer(int size,
CLMemory.Mem... flags)
Creates a CLBuffer with the specified flags and element count. |
|
boolean |
equals(Object obj)
|
|
CL |
getCL()
Return the low level OpenCL interface. |
|
CLContext |
getContext()
Returns the context for this OpenCL object. |
|
CLDevice[] |
getDevices()
Returns all devices associated with this CLContext. |
|
long |
getID()
Returns the OpenCL object handle |
|
CLDevice |
getMaxFlopsDevice()
Returns the device with maximal FLOPS from this context. |
|
CLDevice |
getMaxFlopsDevice(CLDevice.Type type)
Returns the device with maximal FLOPS of the specified device type from this context. |
|
List<CLMemory<? extends Buffer>> |
getMemoryObjects()
Returns a read only shapshot of all allocated memory objects associated with this context. |
|
CLPlatform |
getPlatform()
Returns the CLPlatform this context is running on. |
|
List<CLProgram> |
getPrograms()
Returns a read only shapshot of all programs associated with this context. |
|
List<CLSampler> |
getSamplers()
Returns a read only shapshot of all samplers associated with this context. |
|
CLImageFormat[] |
getSupportedImage2dFormats(CLMemory.Mem... flags)
Returns all supported 2d image formats with the (optional) memory allocation flags. |
|
CLImageFormat[] |
getSupportedImage3dFormats(CLMemory.Mem... flags)
Returns all supported 3d image formats with the (optional) memory allocation flags. |
|
int |
hashCode()
|
|
protected void |
overrideContext(CLDevice device)
|
|
void |
release()
Releases this context and all resources. |
|
void |
removeCLErrorHandler(CLErrorHandler handler)
|
|
protected static long |
toDeviceBitmap(CLDevice.Type[] deviceTypes)
|
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected CLDevice[] devices
protected final Set<CLProgram> programs
protected final Set<CLSampler> samplers
protected final Set<CLMemory<? extends Buffer>> memoryObjects
protected final Map<CLDevice,List<CLCommandQueue>> queuesMap
protected final CLPlatform platform
public final long ID
protected CLContext context
protected final CL cl
Constructor Detail |
---|
protected CLContext(CLPlatform platform, long contextID, CLContext.ErrorDispatcher dispatcher)
Method Detail |
---|
public static CLContext create()
public static CLContext create(CLDevice.Type... deviceTypes)
public static CLContext create(CLPlatform platform)
public static CLContext create(CLPlatform platform, CLDevice.Type... deviceTypes)
public static CLContext create(CLDevice... devices)
protected static long createContextFromType(CLErrorHandler handler, PointerBuffer properties, long deviceType)
protected static long createContext(CLErrorHandler handler, PointerBuffer properties, CLDevice... devices)
public CLProgram createProgram(String src)
public CLProgram createProgram(InputStream source) throws IOException
IOException
- when a IOException occurred while reading or closing the stream.public CLProgram createProgram(Map<CLDevice,byte[]> binaries)
public final CLBuffer<ShortBuffer> createShortBuffer(int size, CLMemory.Mem... flags)
public final CLBuffer<IntBuffer> createIntBuffer(int size, CLMemory.Mem... flags)
public final CLBuffer<LongBuffer> createLongBuffer(int size, CLMemory.Mem... flags)
public final CLBuffer<FloatBuffer> createFloatBuffer(int size, CLMemory.Mem... flags)
public final CLBuffer<DoubleBuffer> createDoubleBuffer(int size, CLMemory.Mem... flags)
public final CLBuffer<ByteBuffer> createByteBuffer(int size, CLMemory.Mem... flags)
public final CLBuffer<ByteBuffer> createByteBuffer(int size, int flags)
public final CLBuffer<?> createBuffer(int size, CLMemory.Mem... flags)
public final CLBuffer<?> createBuffer(int size, int flags)
public final <B extends Buffer> CLBuffer<B> createBuffer(B directBuffer, CLMemory.Mem... flags)
public final <B extends Buffer> CLBuffer<B> createBuffer(B directBuffer, int flags)
public final CLImage2d<?> createImage2d(int width, int height, CLImageFormat format, CLMemory.Mem... flags)
public final CLImage2d<?> createImage2d(int width, int height, int rowPitch, CLImageFormat format, CLMemory.Mem... flags)
public final <B extends Buffer> CLImage2d<B> createImage2d(B directBuffer, int width, int height, CLImageFormat format, CLMemory.Mem... flags)
public final <B extends Buffer> CLImage2d<B> createImage2d(B directBuffer, int width, int height, int rowPitch, CLImageFormat format, CLMemory.Mem... flags)
public final CLImage3d<?> createImage3d(int width, int height, CLImageFormat format, CLMemory.Mem... flags)
public final CLImage3d<?> createImage3d(int width, int height, int depth, int rowPitch, CLImageFormat format, CLMemory.Mem... flags)
public final <B extends Buffer> CLImage3d<B> createImage3d(B directBuffer, int width, int height, int depth, CLImageFormat format, CLMemory.Mem... flags)
public final <B extends Buffer> CLImage3d<B> createImage3d(B directBuffer, int width, int height, int depth, int rowPitch, int slicePitch, CLImageFormat format, CLMemory.Mem... flags)
public CLSampler createSampler(CLSampler.AddressingMode addrMode, CLSampler.FilteringMode filtMode, boolean normalizedCoords)
public void addCLErrorHandler(CLErrorHandler handler)
public void removeCLErrorHandler(CLErrorHandler handler)
public void release()
release
in interface CLResource
protected void overrideContext(CLDevice device)
public CLImageFormat[] getSupportedImage2dFormats(CLMemory.Mem... flags)
public CLImageFormat[] getSupportedImage3dFormats(CLMemory.Mem... flags)
public CLPlatform getPlatform()
public CLContext getContext()
public List<CLProgram> getPrograms()
public List<CLMemory<? extends Buffer>> getMemoryObjects()
public List<CLSampler> getSamplers()
public CLDevice getMaxFlopsDevice()
getMaxFlopsDevice(com.jogamp.opencl.CLDevice.Type)
public CLDevice getMaxFlopsDevice(CLDevice.Type type)
public CLDevice[] getDevices()
public CL getCL()
protected static long toDeviceBitmap(CLDevice.Type[] deviceTypes)
public String toString()
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
protected static CLContext.ErrorDispatcher createErrorHandler()
@Deprecated public final void close()
close
in interface AutoCloseable
AutoCloseable
public long getID()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |