public final class CUDAManager
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
int |
acquireFreeDevice()
Look for the next free device and mark it as busy.
|
java.util.ArrayList<CUDADevice> |
getCUDADevices()
Use this method to obtain a reference to an ArrayList containing
references to all discovered CUDA devices.
|
int |
getDefaultDevice()
Gets the ID of the default device, set to 0 by default.
|
CUDADevice |
getDevice(int deviceId)
Get a reference to the CUDA device by means of its index (with 0 being the first).
|
int |
getDeviceCount()
Identifies the number of available CUDA devices.
|
CUDADevice |
getDeviceWithMostAvailableMemory()
Identifies the CUDA device that has the most memory available.
|
int |
getDoubleThreshold()
Gets the minimum length of a double array that will be
sorted using a GPU if enabled.
|
CUDADevice[] |
getEnabledCUDADevices()
Use this method to return an array of enabled CUDA devices.
|
int |
getFloatThreshold()
Gets the minimum length of a float array that will be
sorted using a GPU if enabled.
|
long |
getFreeMemoryForDevice(int deviceId)
Get the amount of free memory (in bytes) available for the provided CUDA device.
|
static CUDAManager |
getInstance()
Deprecated.
Use
instance() instead. |
int |
getIntThreshold()
Gets the minimum length of an int array that will be
sorted using a GPU if enabled.
|
int |
getLongThreshold()
Gets the minimum length of a long array that will be
sorted using a GPU if enabled.
|
int |
getNextAvailableDevice()
Returns the next CUDA device that is available to run calculations on.
|
static java.lang.String |
getOutputHeader()
Get the header used to prefix all IBM GPU related output.
|
boolean |
getVerboseGPUOutput()
Get the value of the verboseGPUOutput flag.
|
static java.lang.String |
getVersion()
Get the version of this class.
|
boolean |
hasCUDASupport()
Use this method to identify if CUDA is supported on this machine and
within this environment: returns true if the number of CUDA devices
detected is greater than 0.
|
static CUDAManager |
instance()
Return a CUDAManager instance.
|
boolean |
isSortEnabledOnGPU()
This method provides a means to determine if sort is
enabled to be used by any available CUDA device.
|
boolean |
isSortEnforcedOnGPU()
This method provides a means to determine if sort is
forced to be used by any available CUDA device.
|
void |
printAllDeviceInfo()
Print information for each detected CUDA device.
|
void |
releaseDevice(int deviceId)
Mark a device as being free; must be in a try finally block as we MUST
release the handle regardless of whether or not a sort was successful.
|
void |
setDefaultDevice(int deviceId)
Sets the default device to the given device ID.
|
void |
setDevice(int deviceId)
Use this method to set the device to use for subsequent calls.
|
void |
setVerboseGPU(boolean condition)
Set the value of the verboseGPUOutput flag.
|
static void |
tearDown()
Deprecated.
This method has no effect; it will be removed in a future version.
|
@Deprecated public static CUDAManager getInstance() throws GPUConfigurationException, java.lang.SecurityException
instance()
instead.GPUConfigurationException
- This exception is not actually thrown; use instance()
instead.java.lang.SecurityException
- If a security manager exists and the calling thread does not
have permission to access the CUDAManager instance.public static CUDAManager instance() throws java.lang.SecurityException
java.lang.SecurityException
- If a security manager exists and the calling thread does not
have permission to access the CUDAManager instance.public static java.lang.String getOutputHeader()
public static java.lang.String getVersion()
@Deprecated public static void tearDown()
public int acquireFreeDevice()
public java.util.ArrayList<CUDADevice> getCUDADevices()
CUDADevice
for details.public int getDefaultDevice()
public CUDADevice getDevice(int deviceId) throws GPUConfigurationException
deviceId
- The index of the device to retrieve (with 0 being the first).CUDADevice
for details.GPUConfigurationException
- Throws this exception if an invalid deviceId
has been specified.public int getDeviceCount()
public CUDADevice getDeviceWithMostAvailableMemory() throws GPUConfigurationException
GPUConfigurationException
- Throws this exception if an
attempt was made to access an invalid device (no longer available).public int getDoubleThreshold()
public CUDADevice[] getEnabledCUDADevices()
CUDADevice
for details.public int getFloatThreshold()
public long getFreeMemoryForDevice(int deviceId) throws GPUConfigurationException
deviceId
- The index of the device to query (with 0 being the first).GPUConfigurationException
- Throw this exception if cannot get free memory amount.public int getIntThreshold()
public int getLongThreshold()
public int getNextAvailableDevice()
public boolean getVerboseGPUOutput()
public boolean hasCUDASupport()
public boolean isSortEnabledOnGPU()
public boolean isSortEnforcedOnGPU()
public void printAllDeviceInfo()
public void releaseDevice(int deviceId)
deviceId
- The device to be marked as free.public void setDefaultDevice(int deviceId)
deviceId
- The new default device.public void setDevice(int deviceId) throws GPUConfigurationException
deviceId
- Set the default device ID to be this.GPUConfigurationException
- Throws this exception if an invalid device
number was specified.public void setVerboseGPU(boolean condition)
condition
- Whether or not verbose output should be produced.Eclipse OpenJ9 website.
To raise a bug report or suggest an improvement create an Eclipse OpenJ9 issue.
Copyright © 2014, 2025 IBM Corp. and others.