Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEA] New WholeGraph Feature Store for PyG #4432

Merged
merged 138 commits into from
May 30, 2024

Conversation

alexbarghi-nv
Copy link
Member

@alexbarghi-nv alexbarghi-nv commented May 20, 2024

Reimplements the WG feature store for PyG using the FeatureStore interface.
Merge after #4384

Closes rapidsai/wholegraph#47
Closes #4399

seunghwak and others added 30 commits April 2, 2024 17:28
@BradReesWork BradReesWork added this to the 24.06 milestone May 28, 2024
Copy link
Member

@VibhuJawa VibhuJawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have reviewed the following files as requested by @alexbarghi-nv . Have requested changes mostly around the examples . The feature_store and test look good to me.

python/cugraph-pyg/cugraph_pyg/data/feature_store.py
python/cugraph-pyg/cugraph_pyg/tests/data/test_feature_store_mg.py
python/cugraph-pyg/cugraph_pyg/examples/gcn_dist_sg.py

wall_clock_start = time.perf_counter()
device = torch.device("cuda")

from ogb.nodeproppred import PygNodePropPredDataset # noqa: E402
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest fixing import order into Separate Standard, Third-party, and Local Imports.

python/cugraph-pyg/cugraph_pyg/examples/gcn_dist_sg.py Outdated Show resolved Hide resolved
Comment on lines 63 to 74
dataset = PygNodePropPredDataset(name=args.dataset, root=args.dataset_root)
split_idx = dataset.get_idx_split()
data = dataset[0]

graph_store = cugraph_pyg.data.GraphStore()
graph_store[
("node", "rel", "node"), "coo", False, (data.num_nodes, data.num_nodes)
] = data.edge_index

feature_store = cugraph_pyg.data.TensorDictFeatureStore()
feature_store["node", "x"] = data.x
feature_store["node", "y"] = data.y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have function around this to keep it cleaner and not have lingering variables like dataset lying around as they consume memory. Probably return the num_features instead of having dataset live throughput the program duration.

python/cugraph-pyg/cugraph_pyg/examples/gcn_dist_sg.py Outdated Show resolved Hide resolved
python/cugraph-pyg/cugraph_pyg/examples/gcn_dist_sg.py Outdated Show resolved Hide resolved
python/cugraph-pyg/cugraph_pyg/examples/gcn_dist_sg.py Outdated Show resolved Hide resolved
offset = sizes[:rank].sum() if rank > 0 else 0

wg_embedding.scatter(
tensor.clone(memory_format=torch.contiguous_format).cuda(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use tensor.cuda().contiguous() here since .clone() creates a separate copy.?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried that; it does not work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the tensor on the same device before the clone() call? Maybe we can add a fixme here to note the workaround if we didn't meant to create a deepcopy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tensor was on CPU prior to the call

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make an issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@tingyu66 tingyu66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve WholeFeatureStore with a question regarding the workaround for cloning features.

Copy link
Member

@VibhuJawa VibhuJawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for making these changes

@github-actions github-actions bot removed the conda label May 30, 2024
@alexbarghi-nv
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit 1667f7a into rapidsai:branch-24.06 May 30, 2024
131 checks passed
@alexbarghi-nv alexbarghi-nv deleted the pyg-wg branch May 30, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci feature request New feature or request non-breaking Non-breaking change python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WholeFeatureStore for cuGraph-PyG WG as a FeatureStore in cugraph-pyg
7 participants