Class OpenCLDevice

  • All Implemented Interfaces:
    java.lang.Comparable<Device>

    public class OpenCLDevice
    extends Device
    implements java.lang.Comparable<Device>
    • Field Detail

      • logger

        private static java.util.logging.Logger logger
      • 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 java.lang.String shortDescription
      • name

        private java.lang.String name
      • underConfiguration

        private java.util.concurrent.atomic.AtomicBoolean underConfiguration
    • Constructor Detail

      • OpenCLDevice

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

      • 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
      • 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 java.lang.String getName()
      • setName

        public void setName​(java.lang.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 (#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
      • isReservedInterfaceMethod

        private static boolean isReservedInterfaceMethod​(java.lang.reflect.Method _methods)
      • streamToString

        private java.lang.String streamToString​(java.io.InputStream _inputStream)
      • bind

        public <T extends OpenCL<T>> T bind​(java.lang.Class<T> _interface,
                                            java.io.InputStream _inputStream)
      • bind

        public <T extends OpenCL<T>> T bind​(java.lang.Class<T> _interface)
      • bind

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

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object