- java.lang.Object
-
- com.ibm.cuda.Cuda
-
public final class Cuda extends Object
TheCudaclass provides general CUDA utilities.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ByteBufferallocatePinnedHostBuffer(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 intgetDeviceCount()Returns the number of CUDA-capable devices available to the Java host.static intgetDriverVersion()Returns a number identifying the driver version.static intgetRuntimeVersion()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
CudaExceptionwill 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- ifcapacityis negative or larger thanInteger.MAX_VALUE
- The capacity of a ByteBuffer is in general limited to
-
getDeviceCount
public static int getDeviceCount() throws CudaExceptionReturns 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 CudaExceptionReturns a number identifying the driver version. ACudaExceptionwill 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 CudaExceptionReturns a number identifying the runtime version. ACudaExceptionwill be thrown if the CUDA driver is not installed.- Returns:
- the runtime version number
- Throws:
CudaException- if a CUDA exception occurs
-
-