Commit 613a4ff
committed
Fix(paged): fix PAGED_GPU dav_subspace issues: to_range() type-punning and cal_grad reference corruption
- psi.cpp to_range(): Range members are size_t but were bound to const
int& references, causing (size_t)(-1) to be read as -1 via type
punning. When nvec=0 (all bands converged), r2=nvec-1 wraps to
SIZE_MAX, reads as -1 through int&, making r2<r1 true and
triggering 'choose correct range of psi' error.
Fixed by using size_t locals and checking sentinel index via
i1>SIZE_MAX/2 instead of i1<0.
- diago_dav_subspace.cpp cal_grad(): notconv parameter was a const
int& reference to this->notconv. When all_zero=true inside
cal_grad, this->notconv was set to 0, silently mutating the
reference. The subsequent hpsi_func call at line 507 then used
notconv=0, causing nvec=0, r2=(size_t)(-1), and CUBLAS ZGEMM
parameter 10 error.
Fixed by taking a local value copy to break the reference chain.1 parent aaab6dd commit 613a4ff
2 files changed
Lines changed: 35 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
292 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
293 | 297 | | |
294 | 298 | | |
295 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
719 | 715 | | |
720 | 716 | | |
721 | 717 | | |
722 | | - | |
| 718 | + | |
723 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
724 | 727 | | |
725 | | - | |
| 728 | + | |
726 | 729 | | |
727 | 730 | | |
728 | | - | |
| 731 | + | |
729 | 732 | | |
730 | 733 | | |
731 | 734 | | |
732 | | - | |
| 735 | + | |
733 | 736 | | |
734 | 737 | | |
735 | 738 | | |
736 | 739 | | |
737 | | - | |
738 | | - | |
| 740 | + | |
| 741 | + | |
739 | 742 | | |
740 | 743 | | |
741 | 744 | | |
742 | 745 | | |
743 | 746 | | |
744 | | - | |
| 747 | + | |
745 | 748 | | |
746 | 749 | | |
747 | 750 | | |
| |||
0 commit comments