in local_grid.py [0:0]
def __call__(self, args):
stdout_path = pathlib.Path(self.log_dir) / 'stdout'
self.stdout = open(stdout_path, 'w')
stderr_path = pathlib.Path(self.log_dir) / 'stderr'
self.stderr = open(stderr_path, 'w')
sys.stdout = self.stdout
sys.stderr = self.stderr
cuda_id = -1
n_devices = torch.cuda.device_count()
if n_devices > 0:
cuda_id = self.job_id % n_devices
print(f'# {json.dumps(args)}', flush=True)
with torch.cuda.device(cuda_id):
self.runnable(args)