Class OpenCLDevice

java.lang.Object
com.aparapi.device.Device
com.aparapi.device.OpenCLDevice
All Implemented Interfaces:
Comparable<Device>

public class OpenCLDevice extends Device implements Comparable<Device>
  • Field Details

    • logger

      private static Logger logger
    • configurator

      private static IOpenCLDeviceConfigurator configurator
    • platform

      private final OpenCLPlatform platform
    • deviceId

      private final long deviceId
    • maxComputeUnits

      private int maxComputeUnits
    • localMemSize

      private long localMemSize
    • globalMemSize

      private long globalMemSize
    • maxMemAllocSize

      private long maxMemAllocSize
    • sharedMemory

      private boolean sharedMemory
    • shortDescription

      private String shortDescription
    • name

      private String name
    • underConfiguration

      private AtomicBoolean underConfiguration
  • Constructor Details

    • OpenCLDevice

      public OpenCLDevice(OpenCLPlatform _platform, long _deviceId, Device.TYPE _type)
      Minimal constructor
      Parameters:
      _platform -
      _deviceId -
      _type -
  • Method Details

    • setConfigurator

      public static void setConfigurator(IOpenCLDeviceConfigurator _configurator)
      Statically assigns a new configurator for all OpenCL devices detected after the assignment.
      Parameters:
      _configurator - the configurator instance
    • getOpenCLPlatform

      public OpenCLPlatform getOpenCLPlatform()
    • getMaxComputeUnits

      public int getMaxComputeUnits()
    • setMaxComputeUnits

      public void setMaxComputeUnits(int _maxComputeUnits)
    • getLocalMemSize

      public long getLocalMemSize()
    • setLocalMemSize

      public void setLocalMemSize(long _localMemSize)
    • getMaxMemAllocSize

      public long getMaxMemAllocSize()
    • setMaxMemAllocSize

      public void setMaxMemAllocSize(long _maxMemAllocSize)
    • getGlobalMemSize

      public long getGlobalMemSize()
    • setGlobalMemSize

      public void setGlobalMemSize(long _globalMemSize)
    • setMaxWorkItemSize

      public void setMaxWorkItemSize(int _dim, int _value)
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • configure

      public void configure()
      Called by the underlying Aparapi OpenCL platform, upon device detection.
    • getDeviceId

      public long getDeviceId()
      Specified by:
      getDeviceId in class Device
    • setSharedMemory

      public void setSharedMemory(boolean _sharedMemory)
      Configure if device has the memory shared with the host memory.
      Note1: For discrete GPU devices having dedicated memory, thus not shared with host, this should be set to false. This can result in significant kernel execution speed-ups for such HW configurations. Aparapi is unable to detect this property automatically for all devices, unless the client application provides a configurator (
      invalid reference
      #IOpenCLDeviceConfigurator
      ).
      Note2: By default devices are initialized has having shared memory - to maintain backwards compatibility - unless Aparapi can unequivocally identify the device.
      Parameters:
      _sharedMemory -
      • true, if OpenCL device has the memory shared with the host memory
      • false, if OpenCL device is a discrete unit, having dedicated memory, thus not shared with host
    • isSharedMemory

      public boolean isSharedMemory()
      Retrieves the shared memory flag
      Returns:
      • true, if OpenCL device has the memory shared with the host memory
      • false, if OpenCL device is a discrete unit, having dedicated memory, thus not shared with host
    • getShortDescription

      public String getShortDescription()
      Specified by:
      getShortDescription in class Device
    • getArgs

      public List<OpenCLArgDescriptor> getArgs(Method m)
    • isReservedInterfaceMethod

      private static boolean isReservedInterfaceMethod(Method _methods)
    • streamToString

      private String streamToString(InputStream _inputStream)
    • bind

      public <T extends OpenCL<T>> T bind(Class<T> _interface, InputStream _inputStream)
    • bind

      public <T extends OpenCL<T>> T bind(Class<T> _interface)
    • bind

      public <T extends OpenCL<T>> T bind(Class<T> _interface, String _source)
    • listDevices

      public static List<OpenCLDevice> listDevices(Device.TYPE type)
      List OpenCLDevices of a given TYPE, or all OpenCLDevices if type == null.
    • select

      public static OpenCLDevice select(OpenCLDevice.DeviceSelector _deviceSelector)
    • select

      public static OpenCLDevice select(OpenCLDevice.DeviceComparitor _deviceComparitor)
    • select

      public static OpenCLDevice select(OpenCLDevice.DeviceComparitor _deviceComparitor, Device.TYPE _type)
    • toString

      public String toString()
      Overrides:
      toString in class Object