def init_save_folder(self):
        """
        Initialize the save folder for logs, model, checkpoint, and evaluation.
        """
        runid = 1

        if self.opt['world_size'] > 1:
            torch.distributed.barrier()

        if self.opt['rank'] == 0:
            while True:
                save_folder = os.path.join(self.opt['SAVE_DIR'], f"{self.opt['BASENAME']}_conf~", f"run_{runid}")
                try:
                    os.makedirs(save_folder, exist_ok=False)
                    break
                except FileExistsError:
                    runid = runid + 1

        if self.opt['world_size'] > 1:
            torch.distributed.barrier()

        if self.opt['world_size'] > 1:
            runid = 1
            while True:
                save_folder = os.path.join(self.opt['SAVE_DIR'], f"{self.opt['BASENAME']}_conf~", f"run_{runid}")
                if not os.path.exists(save_folder):
                    break
                else:
                    runid += 1

            runid -= 1
            save_folder = os.path.join(self.opt['SAVE_DIR'], f"{self.opt['BASENAME']}_conf~", f"run_{runid}")
            # this second os.makedirs() call on all ranks is to force sync the save_folder creation between blobFuse and local fs
            os.makedirs(save_folder, exist_ok=True)

        self.save_folder = save_folder

        Initialize the save folder for logs, model, checkpoint, and evaluation.
        
trainer/distributed_trainer.py