Skip to content

Commit

Permalink
remove pyinstrument. (dmlc#2772)
Browse files Browse the repository at this point in the history
Co-authored-by: xiang song(charlie.song) <[email protected]>
  • Loading branch information
zheng-da and classicsong authored Mar 22, 2021
1 parent edf6446 commit bb54206
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 30 deletions.
1 change: 0 additions & 1 deletion examples/pytorch/graphsage/experimental/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ This is an example of training GraphSage in a distributed fashion. Before traini

```bash
sudo pip3 install ogb
sudo pip3 install pyinstrument
```

To train GraphSage, it has five steps:
Expand Down
8 changes: 0 additions & 8 deletions examples/pytorch/graphsage/experimental/train_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import torch.optim as optim
import torch.multiprocessing as mp
from torch.utils.data import DataLoader
from pyinstrument import Profiler

def load_subtensor(g, seeds, input_nodes, device):
"""
Expand Down Expand Up @@ -186,9 +185,6 @@ def run(args, device, data):

# Training loop
iter_tput = []
profiler = Profiler()
if args.close_profiler == False:
profiler.start()
epoch = 0
for epoch in range(args.num_epochs):
tic = time.time()
Expand Down Expand Up @@ -253,9 +249,6 @@ def run(args, device, data):
g.ndata['labels'], val_nid, test_nid, args.batch_size_eval, device)
print('Part {}, Val Acc {:.4f}, Test Acc {:.4f}, time: {:.4f}'.format(g.rank(), val_acc, test_acc,
time.time() - start))
if args.close_profiler == False:
profiler.stop()
print(profiler.output_text(unicode=True, color=True))

def main(args):
dgl.distributed.initialize(args.ip_config, args.num_servers, num_workers=args.num_workers)
Expand Down Expand Up @@ -313,7 +306,6 @@ def main(args):
help="Number of sampling processes. Use 0 for no extra process.")
parser.add_argument('--local_rank', type=int, help='get rank of the process')
parser.add_argument('--standalone', action='store_true', help='run in the standalone mode')
parser.add_argument('--close_profiler', action='store_true', help='Close pyinstrument profiler')
args = parser.parse_args()
assert args.num_workers == int(os.environ.get('DGL_NUM_SAMPLER')), \
'The num_workers should be the same value with DGL_NUM_SAMPLER.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import torch.optim as optim
import torch.multiprocessing as mp
from dgl.distributed import DistDataLoader
#from pyinstrument import Profiler

class SAGE(nn.Module):
def __init__(self,
Expand Down Expand Up @@ -328,8 +327,6 @@ def run(args, device, data):
optimizer = optim.Adam(model.parameters(), lr=args.lr)

# Training loop
#profiler = Profiler()
#profiler.start()
epoch = 0
for epoch in range(args.num_epochs):
sample_time = 0
Expand Down
2 changes: 1 addition & 1 deletion examples/pytorch/rgcn/experimental/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is an example of training RGCN node classification in a distributed fashion
Before training, install python libs by pip:

```bash
pip3 install ogb pyinstrument pyarrow
pip3 install ogb pyarrow
```

To train RGCN, it has four steps:
Expand Down
1 change: 0 additions & 1 deletion examples/pytorch/rgcn/experimental/entity_classify_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import tqdm

from ogb.nodeproppred import DglNodePropPredDataset
from pyinstrument import Profiler

class EntityClassify(nn.Module):
""" Entity classification class for RGCN
Expand Down
2 changes: 0 additions & 2 deletions examples/pytorch/rgcn/experimental/get_mag_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import numpy as np
from ogb.nodeproppred import DglNodePropPredDataset

from pyinstrument import Profiler

# Load OGB-MAG.
dataset = DglNodePropPredDataset(name='ogbn-mag')
hg_orig, labels = dataset[0]
Expand Down
7 changes: 0 additions & 7 deletions examples/pytorch/rgcn/experimental/write_mag.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import torch as th
import numpy as np
from ogb.nodeproppred import DglNodePropPredDataset
from pyinstrument import Profiler

# Load OGB-MAG.
dataset = DglNodePropPredDataset(name='ogbn-mag')
Expand All @@ -21,9 +20,6 @@
# subg_nodes[ntype] = np.random.choice(hg.number_of_nodes(ntype), int(hg.number_of_nodes(ntype) / 5), replace=False)
#hg = dgl.compact_graphs(dgl.node_subgraph(hg, subg_nodes))

profiler = Profiler()
profiler.start()

# OGB-MAG is stored in heterogeneous format. We need to convert it into homogeneous format.
g = dgl.to_homogeneous(hg)
g.ndata['orig_id'] = g.ndata[dgl.NID]
Expand Down Expand Up @@ -85,6 +81,3 @@
eid_ranges[etype] = [int(eid[0]), int(eid[-1] + 1)]
with open('mag.json', 'w') as outfile:
json.dump({'nid': nid_ranges, 'eid': eid_ranges}, outfile, indent=4)

profiler.stop()
print(profiler.output_text(unicode=True, color=True))
7 changes: 0 additions & 7 deletions tools/convert_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import torch as th
import pyarrow
from pyarrow import csv
from pyinstrument import Profiler

parser = argparse.ArgumentParser(description='Construct graph partitions')
parser.add_argument('--input-dir', required=True, type=str,
Expand Down Expand Up @@ -58,9 +57,6 @@
etypes = [e[0] for e in etypes]
etypes_map = {e:i for i, e in enumerate(etypes)}

profiler = Profiler()
profiler.start()

def read_feats(file_name):
attrs = csv.read_csv(file_name, read_options=pyarrow.csv.ReadOptions(autogenerate_column_names=True),
parse_options=pyarrow.csv.ParseOptions(delimiter=' '))
Expand Down Expand Up @@ -227,6 +223,3 @@ def read_feats(file_name):
'part_graph': part_graph_file}
with open('{}/{}.json'.format(output_dir, graph_name), 'w') as outfile:
json.dump(part_metadata, outfile, sort_keys=True, indent=4)

profiler.stop()
print(profiler.output_text(unicode=True, color=True))

0 comments on commit bb54206

Please sign in to comment.