Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions megatron/data/biencoder_dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,8 @@ def get_block_samples_mapping(block_dataset, title_dataset, data_prefix, num_epo
'(seconds): {:4f}'.format(
time.time() - start_time))

# This should be a barrier but nccl barrier assumes
# device_index=rank which is not the case for model
# parallel case
counts = torch.cuda.LongTensor([1])
torch.distributed.all_reduce(counts, group=mpu.get_data_parallel_group())
assert counts[0].item() == torch.distributed.get_world_size(
group=mpu.get_data_parallel_group())
# Wait until rank 0 generate the index file.
torch.distributed.barrier(device_ids=[int(os.environ['LOCAL_RANK'])])

# Load indexed dataset.
print_rank_0(' > loading indexed mapping from {}'.format(
Expand Down
12 changes: 3 additions & 9 deletions megatron/data/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,15 +699,9 @@ def get_samples_mapping(indexed_dataset,
print_rank_0(' > elasped time to build and save samples mapping '
'(seconds): {:4f}'.format(
time.time() - start_time))
# This should be a barrier but nccl barrier assumes
# device_index=rank which is not the case for model
# parallel case
counts = torch.cuda.LongTensor([1])
torch.distributed.all_reduce(counts, group=mpu.get_data_parallel_group())
torch.distributed.all_reduce(counts, group=mpu.get_pipeline_model_parallel_group())
assert counts[0].item() == (
torch.distributed.get_world_size() //
torch.distributed.get_world_size(group=mpu.get_tensor_model_parallel_group()))

# Wait until rank 0 generate the index file.
torch.distributed.barrier(device_ids=[int(os.environ['LOCAL_RANK'])])

# Load indexed dataset.
print_rank_0(' > loading indexed mapping from {}'.format(
Expand Down
11 changes: 2 additions & 9 deletions megatron/data/gpt_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,8 @@ def _build_index_mappings(name, data_prefix, documents, sizes,
print_rank_0(' > elasped time to build and save shuffle-idx mapping'
' (seconds): {:4f}'.format(time.time() - start_time))

# This should be a barrier but nccl barrier assumes
# device_index=rank which is not the case for model
# parallel case
counts = torch.cuda.LongTensor([1])
torch.distributed.all_reduce(counts, group=mpu.get_data_parallel_group())
torch.distributed.all_reduce(counts, group=mpu.get_pipeline_model_parallel_group())
assert counts[0].item() == (
torch.distributed.get_world_size() //
torch.distributed.get_world_size(group=mpu.get_tensor_model_parallel_group()))
# Wait until rank 0 generate the index file.
torch.distributed.barrier(device_ids=[int(os.environ['LOCAL_RANK'])])

# Load mappings.
start_time = time.time()
Expand Down
9 changes: 2 additions & 7 deletions megatron/data/realm_dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,8 @@ def get_block_samples_mapping(block_dataset, title_dataset, data_prefix, num_epo
'(seconds): {:4f}'.format(
time.time() - start_time))

# This should be a barrier but nccl barrier assumes
# device_index=rank which is not the case for model
# parallel case
counts = torch.cuda.LongTensor([1])
torch.distributed.all_reduce(counts, group=mpu.get_data_parallel_group())
assert counts[0].item() == torch.distributed.get_world_size(
group=mpu.get_data_parallel_group())
# Wait until rank 0 generate the index file.
torch.distributed.barrier(device_ids=[int(os.environ['LOCAL_RANK'])])

# Load indexed dataset.
print_rank_0(' > loading indexed mapping from {}'.format(
Expand Down