- java.lang.Object
-
- com.ibm.cuda.CudaModule.Cache
-
- Enclosing class:
- CudaModule
public static final class CudaModule.Cache extends Object
TheCache
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 implementObject.equals(Object)
andObject.hashCode()
.
-
-
Constructor Summary
Constructors Constructor Description Cache()
Creates a new cache.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CudaModule
get(CudaDevice device, Object key)
Retrieves an existing module for the specified device and key.CudaModule
put(CudaDevice device, Object key, CudaModule module)
Stores a module in this cache, associating it with the given device and key.
-
-
-
Method Detail
-
get
public CudaModule get(CudaDevice device, Object key)
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
public CudaModule put(CudaDevice device, Object key, CudaModule module)
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
-
-