dgl.graphbolt.cpu_cached_feature

dgl.graphbolt.cpu_cached_feature(fallback_features: Feature | Dict[FeatureKey, Feature], max_cache_size_in_bytes: int, policy: str | None = None, pin_memory: bool = False) β†’ CPUCachedFeature | Dict[FeatureKey, CPUCachedFeature][source]

CPU cached feature wrapping a fallback feature.

Parameters:
  • fallback_features (Union[Feature, Dict[FeatureKey, Feature]]) – The fallback feature(s).

  • max_cache_size_in_bytes (int) – The capacity of the cache in bytes. The size should be a few factors larger than the size of each read request. Otherwise, the caching policy will hang due to all cache entries being read and/or write locked, resulting in a deadlock.

  • policy (str, optional) – The cache eviction policy algorithm name. The available policies are [β€œs3-fifo”, β€œsieve”, β€œlru”, β€œclock”]. Default is β€œsieve”.

  • pin_memory (bool, optional) – Whether the cache storage should be allocated on system pinned memory. Default is False.

Returns:

New feature(s) wrapped with CPUCachedFeature.

Return type:

Union[CPUCachedFeature, Dict[FeatureKey, CPUCachedFeature]]