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
  • 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

      Boolean hasProgram(String name)
      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

      CyCLProgram getProgram(String name)
      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 name
      programSources - Strings containing the individual files comprising the program
      kernelNames - An array of kernel names, as used in the program
      defines - 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 name
      programSource - A sring containing the program source
      kernelNames - An array of kernel names, as used in the program
      defines - 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 name
      resourcePath - Path to the resource with the program's text
      kernelNames - An array of kernel names, as used in the program
      defines - 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 name
      resourcePath - Path to the resource with the program's text
      kernelNames - An array of kernel names, as used in the program
      defines - Dictionary of definitions to be injected as "#define key value"; can be null
      Returns:
      The program if it has been successfully compiled
    • getDeviceSpecificDefines

      HashMap<String,String> 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

      CyCLBuffer createBuffer(Class<?> type, int elements)
      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 type
      elements - Number of elements
      Returns:
      CyCLBuffer object with a pointer to the allocated memory
    • createBuffer

      CyCLBuffer createBuffer(Class<?> type, int elements, int bits)
      Allocates memory on this device without filling it with any data.
      Parameters:
      type - Buffer element type
      elements - Number of elements
      bits - the CL_MEM bits that describe the buffer type
      Returns:
      CyCLBuffer object with a pointer to the allocated memory
    • createWriteBuffer

      CyCLBuffer createWriteBuffer(byte[] data)
      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

      CyCLBuffer createReadBuffer(byte[] data)
      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

      CyCLBuffer createBuffer(byte[] data)
      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

      CyCLBuffer createBuffer(byte[] data, int bits)
      Allocates memory on this device and fills it with host data.
      Parameters:
      data - Byte array with data to be copied
      bits - the CL_MEM bits that describe the buffer type
      Returns:
      CyCLBuffer object with a pointer to the allocated memory
    • createWriteBuffer

      CyCLBuffer createWriteBuffer(short[] data)
      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

      CyCLBuffer createReadBuffer(short[] data)
      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

      CyCLBuffer createBuffer(short[] data)
      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

      CyCLBuffer createBuffer(short[] data, int bits)
      Allocates memory on this device and fills it with host data.
      Parameters:
      data - Int16 array with data to be copied
      bits - the CL_MEM bits that describe the buffer type
      Returns:
      CyCLBuffer object with a pointer to the allocated memory
    • createWriteBuffer

      CyCLBuffer createWriteBuffer(int[] data)
      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

      CyCLBuffer createReadBuffer(int[] data)
      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

      CyCLBuffer createBuffer(int[] data)
      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

      CyCLBuffer createBuffer(int[] data, int bits)
      Allocates memory on this device and fills it with host data.
      Parameters:
      data - Int32 array with data to be copied
      bits - the CL_MEM bits that describe the buffer type
      Returns:
      CyCLBuffer object with a pointer to the allocated memory
    • createWriteBuffer

      CyCLBuffer createWriteBuffer(long[] data)
      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

      CyCLBuffer createReadBuffer(long[] data)
      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

      CyCLBuffer createBuffer(long[] data)
      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

      CyCLBuffer createBuffer(long[] data, int bits)
      Allocates memory on this device and fills it with host data.
      Parameters:
      data - Int64 array with data to be copied
      bits - the CL_MEM bits that describe the buffer type
      Returns:
      CyCLBuffer object with a pointer to the allocated memory
    • createWriteBuffer

      CyCLBuffer createWriteBuffer(float[] data)
      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

      CyCLBuffer createReadBuffer(float[] data)
      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

      CyCLBuffer createBuffer(float[] data)
      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

      CyCLBuffer createBuffer(float[] data, int bits)
      Allocates memory on this device and fills it with host data.
      Parameters:
      data - Float32 array with data to be copied
      bits - the CL_MEM bits that describe the buffer type
      Returns:
      CyCLBuffer object with a pointer to the allocated memory
    • createWriteBuffer

      CyCLBuffer createWriteBuffer(double[] data)
      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

      CyCLBuffer createReadBuffer(double[] data)
      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

      CyCLBuffer createBuffer(double[] data)
      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

      CyCLBuffer createBuffer(double[] data, int bits)
      Allocates memory on this device and fills it with host data.
      Parameters:
      data - Float64 array with data to be copied
      bits - the CL_MEM bits that describe the buffer type
      Returns:
      CyCLBuffer object with a pointer to the allocated memory
    • createLocalSize

      CyCLLocalSize createLocalSize(long size)
      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

      Return the type of this device
      Returns:
      the type of the device