(cfg)
| 55 | |
| 56 | |
| 57 | def create_working_directory(cfg): |
| 58 | file_name = "%s_working_dir.tmp" % os.environ["SLURM_JOB_ID"] |
| 59 | world_size = comm.get_world_size() |
| 60 | if world_size > 1 and not dist.is_initialized(): |
| 61 | comm.init_process_group("nccl", init_method="env://") |
| 62 | |
| 63 | output_dir = os.path.join(os.path.expanduser(cfg.output_dir), |
| 64 | cfg.task["class"], |
| 65 | cfg.task.model["class"] + "_" + time.strftime("%Y-%m-%d-%H-%M-%S")) |
| 66 | |
| 67 | # synchronize working directory |
| 68 | if comm.get_rank() == 0: |
| 69 | with open(file_name, "w") as fout: |
| 70 | fout.write(output_dir) |
| 71 | os.makedirs(output_dir) |
| 72 | comm.synchronize() |
| 73 | if comm.get_rank() != 0: |
| 74 | with open(file_name, "r") as fin: |
| 75 | output_dir = fin.read() |
| 76 | comm.synchronize() |
| 77 | if comm.get_rank() == 0: |
| 78 | os.remove(file_name) |
| 79 | |
| 80 | os.chdir(output_dir) |
| 81 | return output_dir |
| 82 | |
| 83 | def rot_matmul( |
| 84 | a: torch.Tensor, |
nothing calls this directly
no outgoing calls
no test coverage detected