Class CudaModule.Cache
java.lang.Object
com.ibm.cuda.CudaModule.Cache
- Enclosing class:
CudaModule
The
Cache
class provides a simple mechanism to avoid reloading
modules repeatedly. The set of loaded modules is specific to each device
so two pieces of identification are required for each module: the device
and a user-supplied key.
Note: Because this class is implemented with HashMap
, keys
must implement Object.equals(Object)
and Object.hashCode()
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget
(CudaDevice device, Object key) Retrieves an existing module for the specified device and key.put
(CudaDevice device, Object key, CudaModule module) Stores a module in this cache, associating it with the given device and key.
-
Constructor Details
-
Cache
public Cache()Creates a new cache.
-
-
Method Details
-
get
Retrieves an existing module for the specified device and key.- Parameters:
device
- the specified devicekey
- the specified key- Returns:
- return the module associated with the given key on the specified device, or null if no such module exists
-
put
Stores a module in this cache, associating it with the given device and key.- Parameters:
device
- the specified devicekey
- the specified keymodule
- the module to be stored- Returns:
- the module previously associated with the given key on the specified device, or null if no such module exists
-