From bb542066202b34fe0ea72ec0644ec1735334db38 Mon Sep 17 00:00:00 2001 From: Da Zheng Date: Sun, 21 Mar 2021 20:27:12 -0700 Subject: [PATCH] remove pyinstrument. (#2772) Co-authored-by: xiang song(charlie.song) --- examples/pytorch/graphsage/experimental/README.md | 1 - examples/pytorch/graphsage/experimental/train_dist.py | 8 -------- .../graphsage/experimental/train_dist_unsupervised.py | 3 --- examples/pytorch/rgcn/experimental/README.md | 2 +- .../pytorch/rgcn/experimental/entity_classify_dist.py | 1 - examples/pytorch/rgcn/experimental/get_mag_data.py | 2 -- examples/pytorch/rgcn/experimental/write_mag.py | 7 ------- tools/convert_partition.py | 7 ------- 8 files changed, 1 insertion(+), 30 deletions(-) diff --git a/examples/pytorch/graphsage/experimental/README.md b/examples/pytorch/graphsage/experimental/README.md index 9212109a787a..a9770a0a35ea 100644 --- a/examples/pytorch/graphsage/experimental/README.md +++ b/examples/pytorch/graphsage/experimental/README.md @@ -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: diff --git a/examples/pytorch/graphsage/experimental/train_dist.py b/examples/pytorch/graphsage/experimental/train_dist.py index 988056e29481..2761c4f6b20b 100644 --- a/examples/pytorch/graphsage/experimental/train_dist.py +++ b/examples/pytorch/graphsage/experimental/train_dist.py @@ -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): """ @@ -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() @@ -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) @@ -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.' diff --git a/examples/pytorch/graphsage/experimental/train_dist_unsupervised.py b/examples/pytorch/graphsage/experimental/train_dist_unsupervised.py index ee79b9674d4c..ab42298e5485 100644 --- a/examples/pytorch/graphsage/experimental/train_dist_unsupervised.py +++ b/examples/pytorch/graphsage/experimental/train_dist_unsupervised.py @@ -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, @@ -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 diff --git a/examples/pytorch/rgcn/experimental/README.md b/examples/pytorch/rgcn/experimental/README.md index 52a3a5b93470..9d63df9c6159 100644 --- a/examples/pytorch/rgcn/experimental/README.md +++ b/examples/pytorch/rgcn/experimental/README.md @@ -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: diff --git a/examples/pytorch/rgcn/experimental/entity_classify_dist.py b/examples/pytorch/rgcn/experimental/entity_classify_dist.py index ee4f3f0b0db7..178ca5e78848 100644 --- a/examples/pytorch/rgcn/experimental/entity_classify_dist.py +++ b/examples/pytorch/rgcn/experimental/entity_classify_dist.py @@ -29,7 +29,6 @@ import tqdm from ogb.nodeproppred import DglNodePropPredDataset -from pyinstrument import Profiler class EntityClassify(nn.Module): """ Entity classification class for RGCN diff --git a/examples/pytorch/rgcn/experimental/get_mag_data.py b/examples/pytorch/rgcn/experimental/get_mag_data.py index 0b638ce1465f..85c013a4d814 100644 --- a/examples/pytorch/rgcn/experimental/get_mag_data.py +++ b/examples/pytorch/rgcn/experimental/get_mag_data.py @@ -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] diff --git a/examples/pytorch/rgcn/experimental/write_mag.py b/examples/pytorch/rgcn/experimental/write_mag.py index f79f6ffe5cfb..a3103f2b4a7c 100644 --- a/examples/pytorch/rgcn/experimental/write_mag.py +++ b/examples/pytorch/rgcn/experimental/write_mag.py @@ -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') @@ -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] @@ -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)) diff --git a/tools/convert_partition.py b/tools/convert_partition.py index 098aedf9d56b..b52a9662dc29 100644 --- a/tools/convert_partition.py +++ b/tools/convert_partition.py @@ -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, @@ -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=' ')) @@ -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))