MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / GlobalPageManager

Class GlobalPageManager

bitsandbytes/functional.py:25–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25class GlobalPageManager:
26 _instance = None
27
28 def __init__(self):
29 raise RuntimeError("Call get_instance() instead")
30
31 def initialize(self):
32 self.paged_tensors = []
33
34 @classmethod
35 def get_instance(cls):
36 if cls._instance is None:
37 cls._instance = cls.__new__(cls)
38 cls._instance.initialize()
39 return cls._instance
40
41 def prefetch_all(self, to_cpu=False):
42 # assume the first added, will be the
43 # ones that are used first, so swap them in last
44 # in the case they are evicted again
45 for t in self.paged_tensors[::-1]:
46 prefetch_tensor(t, to_cpu)
47
48
49class CUBLAS_Context:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected