"vscode:/vscode.git/clone" did not exist on "10b9d4cd05e86ebe7cd3bbaf60a180ecb8d82194"
Unverified Commit ca5a13fe authored by Zihao Ye's avatar Zihao Ye Committed by GitHub
Browse files

[hotfix] Replace `request_format` and related APIs with `create_format_` (#1924)

* upd

* upd

* upd

* upd
parent 2c141229
......@@ -214,18 +214,6 @@ def thread_wrapped_func(func):
raise exception.__class__(trace)
return decorated_function
def prepare_mp(g):
"""
Explicitly materialize the CSR, CSC and COO representation of the given graph
so that they could be shared via copy-on-write to sampler workers and GPU
trainers.
This is a workaround before full shared memory support on heterogeneous graphs.
"""
for etype in g.canonical_etypes:
g.in_degree(0, etype=etype)
g.out_degree(0, etype=etype)
g.find_edges([0], etype=etype)
def config():
parser = argparse.ArgumentParser(description='GCMC')
parser.add_argument('--seed', default=123, type=int)
......@@ -468,8 +456,8 @@ if __name__ == '__main__':
run(0, n_gpus, args, devices, dataset)
# multi gpu
else:
prepare_mp(dataset.train_enc_graph)
prepare_mp(dataset.train_dec_graph)
dataset.train_enc_graph.create_format_()
dataset.train_dec_graph.create_format_()
procs = []
for proc_id in range(n_gpus):
p = mp.Process(target=run, args=(proc_id, n_gpus, args, devices, dataset))
......
......@@ -147,18 +147,6 @@ class NeighborSampler(object):
hist_blocks.insert(0, hist_block)
return blocks, hist_blocks
def prepare_mp(g):
"""
Explicitly materialize the CSR, CSC and COO representation of the given graph
so that they could be shared via copy-on-write to sampler workers and GPU
trainers.
This is a workaround before full shared memory support on heterogeneous graphs.
"""
g.in_degree(0)
g.out_degree(0)
g.find_edges([0])
def compute_acc(pred, labels):
"""
Compute the accuracy of prediction given the labels.
......@@ -332,7 +320,7 @@ if __name__ == '__main__':
train_mask = g.ndata['train_mask']
val_mask = g.ndata['val_mask']
g.ndata['features'] = features
prepare_mp(g)
g.create_format_()
# Pack data
data = train_mask, val_mask, in_feats, labels, n_classes, g
......
......@@ -175,18 +175,6 @@ def thread_wrapped_func(func):
raise exception.__class__(trace)
return decorated_function
def prepare_mp(g):
"""
Explicitly materialize the CSR, CSC and COO representation of the given graph
so that they could be shared via copy-on-write to sampler workers and GPU
trainers.
This is a workaround before full shared memory support on heterogeneous graphs.
"""
g.in_degree(0)
g.out_degree(0)
g.find_edges([0])
def compute_acc(pred, labels):
"""
Compute the accuracy of prediction given the labels.
......@@ -397,7 +385,7 @@ if __name__ == '__main__':
g.ndata['features'] = features.share_memory_()
create_history_storage(g, args, n_classes)
prepare_mp(g)
g.create_format_()
# Pack data
data = train_mask, val_mask, in_feats, labels, n_classes, g
......
......@@ -89,18 +89,6 @@ class SAGE(nn.Module):
x = y
return y
def prepare_mp(g):
"""
Explicitly materialize the CSR, CSC and COO representation of the given graph
so that they could be shared via copy-on-write to sampler workers and GPU
trainers.
This is a workaround before full shared memory support on heterogeneous graphs.
"""
g.in_degree(0)
g.out_degree(0)
g.find_edges([0])
def compute_acc(pred, labels):
"""
Compute the accuracy of prediction given the labels.
......@@ -241,9 +229,9 @@ if __name__ == '__main__':
else:
train_g = val_g = test_g = g
prepare_mp(train_g)
prepare_mp(val_g)
prepare_mp(test_g)
train_g.create_format_()
val_g.create_format_()
test_g.create_format_()
# Pack data
data = in_feats, n_classes, train_g, val_g, test_g
......
......@@ -90,18 +90,6 @@ class SAGE(nn.Module):
x = y
return y
def prepare_mp(g):
"""
Explicitly materialize the CSR, CSC and COO representation of the given graph
so that they could be shared via copy-on-write to sampler workers and GPU
trainers.
This is a workaround before full shared memory support on heterogeneous graphs.
"""
g.in_degrees(0)
g.out_degrees(0)
g.find_edges([0])
def compute_acc(pred, labels):
"""
Compute the accuracy of prediction given the labels.
......@@ -269,9 +257,9 @@ if __name__ == '__main__':
else:
train_g = val_g = test_g = g
prepare_mp(train_g)
prepare_mp(val_g)
prepare_mp(test_g)
train_g.create_format_()
val_g.create_format_()
test_g.create_format_()
# Pack data
data = in_feats, n_classes, train_g, val_g, test_g
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment