f27475aaeba87052e277df83beaadf002f4fd9da,allennlp/commands/train.py,,_train_worker,#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#,310

Before Change


        params["trainer"]["world_size"] = world_size
        params["trainer"]["distributed"] = True

        torch.cuda.set_device(int(gpu_id))
        dist.init_process_group(
            backend="nccl",
            init_method=f"tcp://{master_addr}:{master_port}",
            world_size=world_size,

After Change


        params["trainer"]["world_size"] = world_size
        params["trainer"]["distributed"] = True

        if gpu_id >= 0:
            torch.cuda.set_device(int(gpu_id))
            dist.init_process_group(
                backend="nccl",
                init_method=f"tcp://{master_addr}:{master_port}",
                world_size=world_size,
                rank=global_rank,
            )
        else:
            dist.init_process_group(
                backend="gloo",
                init_method=f"tcp://{master_addr}:{master_port}",
                world_size=world_size,
                rank=global_rank,
            )
        logging.info(
            f"Process group of world size {world_size} initialized "
            f"for distributed training in worker {global_rank}"
        )
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: allenai/allennlp
Commit Name: f27475aaeba87052e277df83beaadf002f4fd9da
Time: 2020-05-21
Author: dirkg@allenai.org
File Name: allennlp/commands/train.py
Class Name:
Method Name: _train_worker


Project Name: NervanaSystems/coach
Commit Name: a849c17e46ea7188a7b6229c9f68417803e730ad
Time: 2018-11-13
Author: balaji.warft@gmail.com
File Name: rl_coach/agents/agent.py
Class Name: Agent
Method Name: __init__


Project Name: AKSHAYUBHAT/DeepVideoAnalytics
Commit Name: c95913a2967d6d17e71bb1b703f99c00c483bcdc
Time: 2017-09-10
Author: akshayubhat@gmail.com
File Name: dvalib/detector.py
Class Name: TextBoxDetector
Method Name: load