java.lang.Object
com.ibm.cuda.Cuda
The
Cuda
class provides general CUDA utilities.-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
Returns the number of CUDA-capable devices available to the Java host.static int
Returns a number identifying the driver version.static int
Returns a number identifying the runtime version.
-
Method Details
-
allocatePinnedHostBuffer
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
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
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
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
-