Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbarghi-nv committed Apr 2, 2024
1 parent b35ad1f commit 9bc944b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 10 additions & 1 deletion python/cugraph-pyg/cugraph_pyg/examples/cugraph_dist_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
# is intented for users who want to extend cuGraph within a DDP workflow.

import os

import re
import tempfile

import numpy as np
import torch
import torch.multiprocessing as tmp
Expand Down Expand Up @@ -100,6 +101,14 @@ def main():
nprocs=world_size,
)

print("Printing samples...")
for file in os.listdir(directory):
m=re.match(r'batch=([0-9]+)\.([0-9]+)\-([0-9]+)\.([0-9]+)\.parquet', file)
rank, start, _, end = int(m[1]), int(m[2]), int(m[3]), int(m[4])
print(f'File: {file} (batches {start} to {end} for rank {rank})')
print(cudf.read_parquet(os.path.join(directory, file)))
print('\n')


if __name__ == "__main__":
main()
3 changes: 1 addition & 2 deletions python/cugraph/cugraph/gnn/data_loading/dist_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def __write_minibatches_coo(self, minibatch_dict):
has_edge_types = minibatch_dict['edge_type'] is not None
has_weights = minibatch_dict['weight'] is not None

print(minibatch_dict)
if minibatch_dict['renumber_map'] is None:
raise ValueError("Distributed sampling without renumbering is not supported")

Expand Down Expand Up @@ -120,7 +119,7 @@ def __write_minibatches_coo(self, minibatch_dict):
if 'rank' in minibatch_dict:
rank = minibatch_dict['rank']
full_output_path = os.path.join(
self.__directory, f"batch={rank:05d}{start_batch_id:08d}-{rank:05d}{end_batch_id:08d}.parquet"
self.__directory, f"batch={rank:05d}.{start_batch_id:08d}-{rank:05d}.{end_batch_id:08d}.parquet"
)
else:
full_output_path = os.path.join(
Expand Down

0 comments on commit 9bc944b

Please sign in to comment.