Module openj9.cuda
Package com.ibm.cuda

Class CudaModule.Cache

  • Enclosing class:
    CudaModule

    public static final class CudaModule.Cache
    extends Object
    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 Detail

      • Cache

        public Cache()
        Creates a new cache.
    • Method Detail

      • get

        public CudaModule get​(CudaDevice device,
                              Object key)
        Retrieves an existing module for the specified device and key.
        Parameters:
        device - the specified device
        key - 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 device
        key - the specified key
        module - 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