Class CudaModule

java.lang.Object
com.ibm.cuda.CudaModule

public final class CudaModule extends Object
The CudaModule class represents a module that has been loaded on a CUDA-capable device.

When no longer required, a module must be unloaded (see unload()).

  • Constructor Details

    • CudaModule

      public CudaModule(CudaDevice device, byte[] image) throws CudaException
      Loads a module on the specified device, using the given image and the default options.
      Parameters:
      device - the specified device
      image - the module image
      Throws:
      CudaException - if a CUDA exception occurs
      SecurityException - if a security manager exists and the calling thread does not have permission to load GPU modules
    • CudaModule

      public CudaModule(CudaDevice device, byte[] image, CudaJitOptions options) throws CudaException
      Loads a module on the specified device, using the given image and the given options.
      Parameters:
      device - the specified device
      image - the module image
      options - the desired options
      Throws:
      CudaException - if a CUDA exception occurs
      SecurityException - if a security manager exists and the calling thread does not have permission to load GPU modules
    • CudaModule

      public CudaModule(CudaDevice device, InputStream input) throws CudaException, IOException
      Loads a module on the specified device from the given input stream using the default options.
      Parameters:
      device - the specified device
      input - a stream containing the module image
      Throws:
      CudaException - if a CUDA exception occurs
      IOException - if an I/O error occurs reading input
      SecurityException - if a security manager exists and the calling thread does not have permission to load GPU modules
    • CudaModule

      public CudaModule(CudaDevice device, InputStream input, CudaJitOptions options) throws CudaException, IOException
      Loads a module on the specified device from the given input stream using the specified options.
      Parameters:
      device - the specified device
      input - a stream containing the module image
      options - the desired options
      Throws:
      CudaException - if a CUDA exception occurs
      IOException - if an I/O error occurs reading input
      SecurityException - if a security manager exists and the calling thread does not have permission to load GPU modules
  • Method Details

    • getFunction

      public CudaFunction getFunction(String name) throws CudaException
      Returns the function of the specified name from this module.
      Parameters:
      name - the link-name of the desired function
      Returns:
      the function of the specified name
      Throws:
      CudaException - if a CUDA exception occurs
      IllegalStateException - if this module has been unloaded (see unload())
    • getGlobal

      public CudaGlobal getGlobal(String name) throws CudaException
      Returns the global variable of the specified name from this module.
      Parameters:
      name - the link-name of the desired global variable
      Returns:
      the global variable of the specified name
      Throws:
      CudaException - if a CUDA exception occurs
      IllegalStateException - if this module has been unloaded (see unload())
    • getSurface

      public CudaSurface getSurface(String name) throws CudaException
      Returns the surface of the specified name from this module.
      Parameters:
      name - the link-name of the desired surface
      Returns:
      the surface of the specified name
      Throws:
      CudaException - if a CUDA exception occurs
      IllegalStateException - if this module has been unloaded (see unload())
    • getTexture

      public CudaTexture getTexture(String name) throws CudaException
      Returns the texture of the specified name from this module.
      Parameters:
      name - the link-name of the desired texture
      Returns:
      the texture of the specified name
      Throws:
      CudaException - if a CUDA exception occurs
      IllegalStateException - if this module has been unloaded (see unload())
    • unload

      public void unload() throws CudaException
      Unloads this module from the associated device.

      Note that this has no effect on any caches.

      Throws:
      CudaException - if a CUDA exception occurs