Skip to content

[Code scan] op2c overlap tensors stay on CPU after CUDA overlap generation #363

Description

@njzjz

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions