Package org.cytoscape.cycl
Interface CyCLDevice
public interface CyCLDevice
Represents functionality associated with a single OpenCL device.
All operations, e. g. memory allocation or kernel execution, should be
performed through the appropriate CyCLDevice object.
All devices present in the system are initialized as a CyCLDevice object
when Cytoscape starts. Manual creation should not be needed.
- Author:
- Dimitry Tegunov
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
The OpenCL list of device types. -
Method Summary
Modifier and TypeMethodDescriptionaddProgram
(String name, String[] programSources, String[] kernelNames, HashMap<String, String> defines, boolean silentCompilation) Compiles a program and its kernels, and stores it for further use.addProgram
(String name, String programSource, String[] kernelNames, HashMap<String, String> defines, boolean silentCompilation) Compiles a program and its kernels, and stores it for further use.addProgram
(String name, URL resourcePath, String[] kernelNames, HashMap<String, String> defines, boolean silentCompilation) Compiles a program and its kernels, and stores it for further use.createBuffer
(byte[] data) Allocate a buffer that will be both read and written to/from the device.createBuffer
(byte[] data, int bits) Allocates memory on this device and fills it with host data.createBuffer
(double[] data) Allocate a buffer that will be both read and written to/from the device.createBuffer
(double[] data, int bits) Allocates memory on this device and fills it with host data.createBuffer
(float[] data) Allocate a buffer that will be both read and written to/from the device.createBuffer
(float[] data, int bits) Allocates memory on this device and fills it with host data.createBuffer
(int[] data) Allocate a buffer that will be both read and written to/from the device.createBuffer
(int[] data, int bits) Allocates memory on this device and fills it with host data.createBuffer
(long[] data) Allocate a buffer that will be both read and written to/from the device.createBuffer
(long[] data, int bits) Allocates memory on this device and fills it with host data.createBuffer
(short[] data) Allocate a buffer that will be both read and written to/from the device.createBuffer
(short[] data, int bits) Allocates memory on this device and fills it with host data.createBuffer
(Class<?> type, int elements) Allocates memory on this device without filling it with any data.createBuffer
(Class<?> type, int elements, int bits) Allocates memory on this device without filling it with any data.createLocalSize
(long size) Create a local size object that can be used to allocate local memorycreateReadBuffer
(byte[] data) Allocate a buffer that will be read from the device.createReadBuffer
(double[] data) Allocate a buffer that will be read from the device.createReadBuffer
(float[] data) Allocate a buffer that will be read from the device.createReadBuffer
(int[] data) Allocate a buffer that will be read from the device.createReadBuffer
(long[] data) Allocate a buffer that will be read from the device.createReadBuffer
(short[] data) Allocate a buffer that will be read from the device.createWriteBuffer
(byte[] data) Allocate a buffer that will be sent to the device and fills it with host data.createWriteBuffer
(double[] data) Allocate a buffer that will be sent to the device and fills it with host data.createWriteBuffer
(float[] data) Allocate a buffer that will be sent to the device and fills it with host data.createWriteBuffer
(int[] data) Allocate a buffer that will be sent to the device and fills it with host data.createWriteBuffer
(long[] data) Allocate a buffer that will be sent to the device and fills it with host data.createWriteBuffer
(short[] data) Allocate a buffer that will be sent to the device and fills it with host data.void
Pauses the calling thread until all items in the device's command queue have been finished.forceAddProgram
(String name, URL resourcePath, String[] kernelNames, HashMap<String, String> defines, boolean silentCompilation) Compiles a program and its kernels, and stores it, possibly replacing (and destroying) an old instance.long
Return the best block size for this devicelong
getBestBlockSize
(long n) Suggests an optimal block (work item) size for the given global item count.long
Return the best warp size for this devicelong
Gets the underlying LWJGL device ID.Gets a dictionary of device-specific values that will be defined in the compiled programlong
Return the maximum work group size for this devicegetName()
Return the name of this deviceGets the underlying LWJGL platform ID.getProgram
(String name) Attempts to find a pre-compiled program with the given name.getType()
Return the type of this deviceReturn the vendor of this deviceReturn the version of this devicehasProgram
(String name) Determines if a program with the given name has already been compiled and stored.double
performBenchmark
(boolean useOffsets) Run a simple benchmark on this OpenCL Device and return the runtime
-
Method Details
-
performBenchmark
double performBenchmark(boolean useOffsets) Run a simple benchmark on this OpenCL Device and return the runtime- Returns:
- benchmark runtime
-
getDevice
long getDevice()Gets the underlying LWJGL device ID.- Returns:
- LWJGL device ID
-
getPlatform
CyCLPlatform getPlatform()Gets the underlying LWJGL platform ID.- Returns:
- LWJGL platform ID
-
getBestBlockSize
long getBestBlockSize(long n) Suggests an optimal block (work item) size for the given global item count.- Parameters:
n
- Global item count- Returns:
- Optimal block size for this architecture
-
getBestWarpSize
long getBestWarpSize()Return the best warp size for this device- Returns:
- best warp size for the device
-
getBestBlockSize
long getBestBlockSize()Return the best block size for this device- Returns:
- best block size for the device
-
getMaxWorkGroupSize
long getMaxWorkGroupSize()Return the maximum work group size for this device- Returns:
- best block size for the device
-
hasProgram
Determines if a program with the given name has already been compiled and stored.- Parameters:
name
- Program name- Returns:
- True if the program has been compiled, false otherwise
-
getProgram
Attempts to find a pre-compiled program with the given name.- Parameters:
name
- Program name- Returns:
- The program if it is found, null otherwise
-
addProgram
CyCLProgram addProgram(String name, String[] programSources, String[] kernelNames, HashMap<String, String> defines, boolean silentCompilation) Compiles a program and its kernels, and stores it for further use.- Parameters:
name
- Program nameprogramSources
- Strings containing the individual files comprising the programkernelNames
- An array of kernel names, as used in the programdefines
- Dictionary of definitions to be injected as "#define key value"; can be null- Returns:
- The program if it has been successfully compiled
-
addProgram
CyCLProgram addProgram(String name, String programSource, String[] kernelNames, HashMap<String, String> defines, boolean silentCompilation) Compiles a program and its kernels, and stores it for further use.- Parameters:
name
- Program nameprogramSource
- A sring containing the program sourcekernelNames
- An array of kernel names, as used in the programdefines
- Dictionary of definitions to be injected as "#define key value"; can be null- Returns:
- The program if it has been successfully compiled
-
addProgram
CyCLProgram addProgram(String name, URL resourcePath, String[] kernelNames, HashMap<String, String> defines, boolean silentCompilation) Compiles a program and its kernels, and stores it for further use.- Parameters:
name
- Program nameresourcePath
- Path to the resource with the program's textkernelNames
- An array of kernel names, as used in the programdefines
- Dictionary of definitions to be injected as "#define key value"; can be null- Returns:
- The program if it has been successfully compiled
-
forceAddProgram
CyCLProgram forceAddProgram(String name, URL resourcePath, String[] kernelNames, HashMap<String, String> defines, boolean silentCompilation) Compiles a program and its kernels, and stores it, possibly replacing (and destroying) an old instance.- Parameters:
name
- Program nameresourcePath
- Path to the resource with the program's textkernelNames
- An array of kernel names, as used in the programdefines
- Dictionary of definitions to be injected as "#define key value"; can be null- Returns:
- The program if it has been successfully compiled
-
getDeviceSpecificDefines
Gets a dictionary of device-specific values that will be defined in the compiled program- Returns:
- Dictionary of key-value pairs, as in "#define key value"
-
finishQueue
void finishQueue()Pauses the calling thread until all items in the device's command queue have been finished. -
createBuffer
Allocates memory on this device without filling it with any data. This assumes it's going to be a read buffer!!- Parameters:
type
- Buffer element typeelements
- Number of elements- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocates memory on this device without filling it with any data.- Parameters:
type
- Buffer element typeelements
- Number of elementsbits
- the CL_MEM bits that describe the buffer type- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createWriteBuffer
Allocate a buffer that will be sent to the device and fills it with host data.- Parameters:
data
- Byte array with data to be copied- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createReadBuffer
Allocate a buffer that will be read from the device.- Parameters:
data
- Byte array the data will be copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocate a buffer that will be both read and written to/from the device.- Parameters:
data
- Byte array the data will be filled with and copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocates memory on this device and fills it with host data.- Parameters:
data
- Byte array with data to be copiedbits
- the CL_MEM bits that describe the buffer type- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createWriteBuffer
Allocate a buffer that will be sent to the device and fills it with host data.- Parameters:
data
- Int16 array with data to be copied- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createReadBuffer
Allocate a buffer that will be read from the device.- Parameters:
data
- Int16 array the data will be copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocate a buffer that will be both read and written to/from the device.- Parameters:
data
- Int16 array the data will be filled with and copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocates memory on this device and fills it with host data.- Parameters:
data
- Int16 array with data to be copiedbits
- the CL_MEM bits that describe the buffer type- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createWriteBuffer
Allocate a buffer that will be sent to the device and fills it with host data.- Parameters:
data
- Int32 array with data to be copied- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createReadBuffer
Allocate a buffer that will be read from the device.- Parameters:
data
- Int32 array the data will be copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocate a buffer that will be both read and written to/from the device.- Parameters:
data
- Int32 array the data will be filled with and copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocates memory on this device and fills it with host data.- Parameters:
data
- Int32 array with data to be copiedbits
- the CL_MEM bits that describe the buffer type- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createWriteBuffer
Allocate a buffer that will be sent to the device and fills it with host data.- Parameters:
data
- Int64 array with data to be copied- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createReadBuffer
Allocate a buffer that will be read from the device.- Parameters:
data
- Int64 array the data will be copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocate a buffer that will be both read and written to/from the device.- Parameters:
data
- Int64 array the data will be filled with and copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocates memory on this device and fills it with host data.- Parameters:
data
- Int64 array with data to be copiedbits
- the CL_MEM bits that describe the buffer type- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createWriteBuffer
Allocate a buffer that will be sent to the device and fills it with host data.- Parameters:
data
- Float32 array with data to be copied- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createReadBuffer
Allocate a buffer that will be read from the device.- Parameters:
data
- Float32 array the data will be copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocate a buffer that will be both read and written to/from the device.- Parameters:
data
- Float32 array the data will be filled with and copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocates memory on this device and fills it with host data.- Parameters:
data
- Float32 array with data to be copiedbits
- the CL_MEM bits that describe the buffer type- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createWriteBuffer
Allocate a buffer that will be sent to the device and fills it with host data.- Parameters:
data
- Float64 array with data to be copied- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createReadBuffer
Allocate a buffer that will be read from the device.- Parameters:
data
- Float64 array the data will be copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocate a buffer that will be both read and written to/from the device.- Parameters:
data
- Float64 array the data will be filled with and copied into- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createBuffer
Allocates memory on this device and fills it with host data.- Parameters:
data
- Float64 array with data to be copiedbits
- the CL_MEM bits that describe the buffer type- Returns:
- CyCLBuffer object with a pointer to the allocated memory
-
createLocalSize
Create a local size object that can be used to allocate local memory- Parameters:
size
- the size in bytes of the local object- Returns:
- the CyCLLocalSize object
-
getName
String getName()Return the name of this device -
getVendor
String getVendor()Return the vendor of this device -
getVersion
String getVersion()Return the version of this device -
getType
CyCLDevice.DeviceTypes getType()Return the type of this device- Returns:
- the type of the device
-