(self)
| 44 | self._enabled = True |
| 45 | |
| 46 | def _guess_devices(self): |
| 47 | env = os.environ.get('CUDA_VISIBLE_DEVICES') |
| 48 | if env is None: |
| 49 | devices = list(range(get_num_gpu())) |
| 50 | if len(devices) > 1: |
| 51 | logger.warn("[GPUUtilizationTracker] Both devices and CUDA_VISIBLE_DEVICES are None! " |
| 52 | "Will monitor all {} visible GPUs!".format(len(devices))) |
| 53 | else: |
| 54 | if len(env): |
| 55 | devices = list(map(int, env.split(','))) |
| 56 | else: |
| 57 | devices = [] |
| 58 | return devices |
| 59 | |
| 60 | def _setup_graph(self): |
| 61 | # special heuristics for Horovod |
no test coverage detected