- java.lang.Object
-
- com.ibm.cuda.Cuda
-
public final class Cuda extends Object
TheCuda
class provides general CUDA utilities.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ByteBuffer
allocatePinnedHostBuffer(long capacity)
Allocates a new direct byte buffer, backed by page-locked host memory; enabling optimal performance of transfers to and from device memory.static int
getDeviceCount()
Returns the number of CUDA-capable devices available to the Java host.static int
getDriverVersion()
Returns a number identifying the driver version.static int
getRuntimeVersion()
Returns a number identifying the runtime version.
-
-
-
Method Detail
-
allocatePinnedHostBuffer
public static ByteBuffer allocatePinnedHostBuffer(long capacity) throws CudaException
Allocates a new direct byte buffer, backed by page-locked host memory; enabling optimal performance of transfers to and from device memory.The position of the returned buffer will be zero; its limit and capacity will be
capacity
; its order will beLITTLE_ENDIAN
.Notes:
- The capacity of a ByteBuffer is in general limited to
Integer.MAX_VALUE
- that limit also applies and is enforced here. - Even though the result is backed by host memory, a
CudaException
will be thrown if the driver is not installed because registration of that host memory with the driver is integral to the behavior of this method.
- Parameters:
capacity
- the desired capacity, in bytes, of the buffer- Returns:
- the new buffer
- Throws:
CudaException
- if a CUDA exception occursIllegalArgumentException
- ifcapacity
is negative or larger thanInteger.MAX_VALUE
- The capacity of a ByteBuffer is in general limited to
-
getDeviceCount
public static int getDeviceCount() throws CudaException
Returns the number of CUDA-capable devices available to the Java host.- Returns:
- the number of available CUDA-capable devices
- Throws:
CudaException
- if a CUDA exception occurs
-
getDriverVersion
public static int getDriverVersion() throws CudaException
Returns a number identifying the driver version. ACudaException
will be thrown if the CUDA driver is not installed.- Returns:
- the driver version number
- Throws:
CudaException
- if a CUDA exception occurs
-
getRuntimeVersion
public static int getRuntimeVersion() throws CudaException
Returns a number identifying the runtime version. ACudaException
will be thrown if the CUDA driver is not installed.- Returns:
- the runtime version number
- Throws:
CudaException
- if a CUDA exception occurs
-
-