deepmodeling / deepmodeling/DeePTB
[Code scan] op2c overlap tensors stay on CPU after CUDA overlap generation
- Dominant language
- Python
- Stars
- 122
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
This issue is part of a Codex global repository scan.
Problem:
`compute_overlap()` records the original input device, creates overlap features via `block_to_feature()`, then calls `.to(device)` without assigning the returned tensors. `Tensor.to()` is not in-place.
Code reference:
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/postprocess/ovp2c.py#L66-L69
Impact:
`node_overlap` and `edge_overlap` remain on CPU, causing device mismatches later for CUDA calculations using op2c-generated overlaps.
Suggested fix:
Assign the converted tensors back into the data dict, for example `data[_keys.NODE_OVERLAP_KEY] = data[_keys.NODE_OVERLAP_KEY].to(device)` and the same for edge overlap.
Contributor guide
Research direction
Read dptb/postprocess/ovp2c.py around lines 66-69 and trace how compute_overlap() stores node_overlap and edge_overlap after block_to_feature(). Verify that both tensors are assigned to the input device, then exercise the CUDA op2c overlap path and confirm later calculations no longer encounter device mismatches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100