java.lang.Object
com.ibm.cuda.CudaModule
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()
).
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
TheCache
class provides a simple mechanism to avoid reloading modules repeatedly. -
Constructor Summary
ConstructorDescriptionCudaModule
(CudaDevice device, byte[] image) Loads a module on the specified device, using the given image and the default options.CudaModule
(CudaDevice device, byte[] image, CudaJitOptions options) Loads a module on the specified device, using the given image and the given options.CudaModule
(CudaDevice device, InputStream input) Loads a module on the specified device from the given input stream using the default options.CudaModule
(CudaDevice device, InputStream input, CudaJitOptions options) Loads a module on the specified device from the given input stream using the specified options. -
Method Summary
Modifier and TypeMethodDescriptiongetFunction
(String name) Returns the function of the specified name from this module.Returns the global variable of the specified name from this module.getSurface
(String name) Returns the surface of the specified name from this module.getTexture
(String name) Returns the texture of the specified name from this module.void
unload()
Unloads this module from the associated device.
-
Constructor Details
-
CudaModule
Loads a module on the specified device, using the given image and the default options.- Parameters:
device
- the specified deviceimage
- the module image- Throws:
CudaException
- if a CUDA exception occursSecurityException
- if a security manager exists and the calling thread does not have permission to load GPU modules
-
CudaModule
Loads a module on the specified device, using the given image and the given options.- Parameters:
device
- the specified deviceimage
- the module imageoptions
- the desired options- Throws:
CudaException
- if a CUDA exception occursSecurityException
- if a security manager exists and the calling thread does not have permission to load GPU modules
-
CudaModule
Loads a module on the specified device from the given input stream using the default options.- Parameters:
device
- the specified deviceinput
- a stream containing the module image- Throws:
CudaException
- if a CUDA exception occursIOException
- if an I/O error occurs readinginput
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 deviceinput
- a stream containing the module imageoptions
- the desired options- Throws:
CudaException
- if a CUDA exception occursIOException
- if an I/O error occurs readinginput
SecurityException
- if a security manager exists and the calling thread does not have permission to load GPU modules
-
-
Method Details
-
getFunction
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 occursIllegalStateException
- if this module has been unloaded (seeunload()
)
-
getGlobal
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 occursIllegalStateException
- if this module has been unloaded (seeunload()
)
-
getSurface
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 occursIllegalStateException
- if this module has been unloaded (seeunload()
)
-
getTexture
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 occursIllegalStateException
- if this module has been unloaded (seeunload()
)
-
unload
Unloads this module from the associated device.Note that this has no effect on any
caches
.- Throws:
CudaException
- if a CUDA exception occurs
-