| 23 | |
| 24 | |
| 25 | class 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 | |
| 49 | class CUBLAS_Context: |
nothing calls this directly
no outgoing calls
no test coverage detected