deepmodeling / deepmodeling/DeePTB

[Code scan] Pardiso HDF5 export fails for CUDA tensors

Open Beginner friendly
#362 0 comments 0 reactions 0 assignees View on GitHub
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:
`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.

Contributor guide

Open the contributing guide

Research direction

Open dptb/postprocess/unified/system.py around TBSystem._save_h5() at lines 902-907 and trace how to_pardiso() and to_pardiso_json() reach the HDF5 export. Verify the failure with CUDA-backed tensor blocks, then confirm both export paths complete and produce readable HDF5 output without the CUDA conversion error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.