def __init__(self, devices=None):
        """
        Args:
            devices (list[int]): physical GPU ids. If None, will use CUDA_VISIBLE_DEVICES
        """
        assert os.name != 'nt', "GPUUtilizationTracker does not support windows!"
        if devices is None:
            env = os.environ.get('CUDA_VISIBLE_DEVICES')
            if env is None:
                self._devices = list(range(get_num_gpu()))
                logger.warn("[GPUUtilizationTracker] Both devices and CUDA_VISIBLE_DEVICES are None! "
                            "Will monitor all {} visible GPUs!".format(len(self._devices)))
            else:
                if len(env):
                    self._devices = list(map(int, env.split(',')))
                else:
                    self._devices = []
        else:
            self._devices = devices
        assert len(self._devices), "[GPUUtilizationTracker] No GPU device given!"
def __init__ ( self , devices = None ) : assert os . name != 'nt' , "GPUUtilizationTracker does not support windows!" if devices is None : env = os . environ . get ( 'CUDA_VISIBLE_DEVICES' ) if env is None : self . _devices = list ( range ( get_num_gpu ( ) ) ) logger . warn ( "[GPUUtilizationTracker] Both devices and CUDA_VISIBLE_DEVICES are None! " "Will monitor all {} visible GPUs!" . format ( len ( self . _devices ) ) ) else : if len ( env ) : self . _devices = list ( map ( int , env . split ( ',' ) ) ) else : self . _devices = [ ] else : self . _devices = devices assert len ( self . _devices ) , "[GPUUtilizationTracker] No GPU device given!"
Args:
            devices (list[int]): physical GPU ids. If None, will use CUDA_VISIBLE_DEVICES