Skip to content

[Code scan] Pardiso HDF5 export fails for CUDA tensors #362

Description

@njzjz

This issue is part of a Codex global repository scan.

Problem:
TBSystem._save_h5() writes tensor blocks with block.detach().numpy(). Pardiso export gets HR/SR from the calculator on the model device, so CUDA-backed models can pass CUDA tensors into this writer.

Code reference:
https://github.com/deepmodeling/deeptb/blob/86c60c73996f0dd961c3138f2e88424382cb734e/dptb/postprocess/unified/system.py#L902-L907

Impact:
to_pardiso() and to_pardiso_json() can fail during HDF5 export when the model/calculator runs on CUDA.

Suggested fix:
Use block.detach().cpu().numpy() for tensor blocks before creating HDF5 datasets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions