Module openj9.cuda
Package com.ibm.cuda

Class Cuda

java.lang.Object
com.ibm.cuda.Cuda

public final class Cuda extends Object
The Cuda class provides general CUDA utilities.
  • Method Details

    • 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 be LITTLE_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 occurs
      IllegalArgumentException - if capacity is negative or larger than Integer.MAX_VALUE
    • 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. A CudaException 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. A CudaException will be thrown if the CUDA driver is not installed.
      Returns:
      the runtime version number
      Throws:
      CudaException - if a CUDA exception occurs