-
Notifications
You must be signed in to change notification settings - Fork 77
Support CUDA 12.8 #309
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
Merged
gbg141
merged 5 commits into
geometric-intelligence:zaz/fix-deprecations
from
zaz:support-cu128
Apr 17, 2026
Merged
Support CUDA 12.8 #309
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
da969a2
feat: auto-detect torch version for PyG wheel resolution
zaz 661636e
feat: use pre-built wheels for torch-sparse/scatter/cluster
zaz 4e65dd7
feat: add CUDA 12.8 support
zaz d864c88
refactor: make torch-sparse/scatter/cluster deps optional
zaz 9741e93
test: add import-without-sparse test
zaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| """Tests for package import behavior.""" | ||
|
|
||
| import subprocess | ||
| import sys | ||
|
|
||
|
|
||
| def test_import_without_sparse(): | ||
| """Verify topobench imports without torch_sparse/scatter/cluster. | ||
|
|
||
| Runs in a subprocess that blocks the sparse imports via sys.modules | ||
| to avoid modifying the test environment. | ||
| """ | ||
| result = subprocess.run( | ||
| [ | ||
| sys.executable, | ||
| "-c", | ||
| "import sys;" | ||
| "sys.modules['torch_sparse'] = None;" | ||
| "sys.modules['torch_scatter'] = None;" | ||
| "sys.modules['torch_cluster'] = None;" | ||
| "import topobench;" | ||
| "from topobench.nn.backbones.graph import BACKBONE_CLASSES;" | ||
| "from topobench.nn.backbones.hypergraph import BACKBONE_CLASSES;" | ||
| "print('ok')", | ||
| ], | ||
| capture_output=True, | ||
| text=True, | ||
| ) | ||
| assert result.returncode == 0, ( | ||
| f"import topobench failed without sparse packages:\n{result.stderr}" | ||
| ) | ||
| assert "ok" in result.stdout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,6 @@ | |
| import torch | ||
| from torch import nn | ||
| from torch_geometric.utils import degree | ||
| from torch_scatter import scatter_add | ||
|
|
||
| sys.path.append(os.path.dirname(os.path.abspath(__file__))) | ||
| from .laplace import ( | ||
|
|
@@ -170,6 +169,8 @@ def forward(self, maps): | |
| saved_tril_maps : torch.Tensor | ||
| Saved lower triangular restriction maps for analysis. | ||
| """ | ||
| from torch_scatter import scatter_add | ||
|
|
||
| assert len(maps.size()) == 2 | ||
| assert maps.size(1) == self.d | ||
| left_idx, right_idx = self.left_right_idx | ||
|
|
@@ -352,6 +353,8 @@ def forward(self, maps): | |
| saved_tril_maps : torch.Tensor | ||
| Saved lower triangular transport maps for analysis. | ||
| """ | ||
| from torch_scatter import scatter_add | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (same comment!) |
||
|
|
||
| left_idx, right_idx = self.left_right_idx | ||
| tril_row, tril_col = self.vertex_tril_idx | ||
| tril_indices, diag_indices = self.tril_indices, self.diag_indices | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
| import torch.nn as nn | ||
| import torch.nn.functional as F | ||
| import torch_geometric | ||
| import torch_scatter | ||
|
|
||
|
|
||
| class EDGNN(nn.Module): | ||
|
|
@@ -482,6 +481,8 @@ def forward(self, X, vertex, edges, X0): | |
| Tensor | ||
| Output features. | ||
| """ | ||
| import torch_scatter | ||
|
|
||
| N = X.shape[-2] | ||
|
|
||
| Xve = self.W1(X)[..., vertex, :] # [nnz, C] | ||
|
|
@@ -562,6 +563,8 @@ def forward(self, X, vertex, edges, X0, beta=1.0): | |
| Tensor | ||
| Output features. | ||
| """ | ||
| import torch_scatter | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason why we need import torch_scatter within methods instead of globally? |
||
|
|
||
| N = X.shape[-2] | ||
|
|
||
| Xve = X[..., vertex, :] # [nnz, C] | ||
|
|
@@ -666,6 +669,8 @@ def forward(self, X, vertex, edges, X0): | |
| Tensor | ||
| Output features. | ||
| """ | ||
| import torch_scatter | ||
|
|
||
| N = X.shape[-2] | ||
|
|
||
| Xve = self.W1(X[..., vertex, :]) # [nnz, C] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why we need import torch_scatter within methods instead of globally?