Skip to content

Commit b3691d0

Browse files
GenZeal-LinGengze Lin
andauthored
fix(gpu): guard qq synchronization without projectors (deepmodeling#7816)
* fix(gpu): guard qq synchronization without projectors * test(gpu): re-enable cases fixed by deepmodeling#7681 --------- Co-authored-by: Gengze Lin <gengze@DESKTOP-RUU2CTC.localdomain>
1 parent 0a91426 commit b3691d0

2 files changed

Lines changed: 32 additions & 23 deletions

File tree

source/source_pw/module_pwdft/vnl_pw.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -768,10 +768,13 @@ void pseudopot_cell_vnl::init_vnl(UnitCell& cell, const ModulePW::PW_Basis* rho_
768768
castmem_d2s_h2d_op()(this->s_nhtol, this->nhtol.c, this->nhtol.nr * this->nhtol.nc);
769769
castmem_d2s_h2d_op()(this->s_nhtolm, this->nhtolm.c, this->nhtolm.nr * this->nhtolm.nc);
770770
castmem_d2s_h2d_op()(this->s_tab, this->tab.ptr, this->tab.getSize());
771-
castmem_d2s_h2d_op()(this->s_qq_nt, this->qq_nt.ptr, this->qq_nt.getSize());
772-
castmem_z2c_h2d_op()(this->c_qq_so, this->qq_so.ptr, this->qq_so.getSize());
771+
if (this->nhm > 0)
772+
{
773+
castmem_d2s_h2d_op()(this->s_qq_nt, this->qq_nt.ptr, this->qq_nt.getSize());
774+
castmem_z2c_h2d_op()(this->c_qq_so, this->qq_so.ptr, this->qq_so.getSize());
775+
}
773776
}
774-
if (PARAM.globalv.has_double_data)
777+
if (PARAM.globalv.has_double_data && this->nhm > 0)
775778
{
776779
syncmem_z2z_h2d_op()(this->z_qq_so, this->qq_so.ptr, this->qq_so.getSize());
777780
}
@@ -782,7 +785,10 @@ void pseudopot_cell_vnl::init_vnl(UnitCell& cell, const ModulePW::PW_Basis* rho_
782785
syncmem_d2d_h2d_op()(this->d_nhtol, this->nhtol.c, this->nhtol.nr * this->nhtol.nc);
783786
syncmem_d2d_h2d_op()(this->d_nhtolm, this->nhtolm.c, this->nhtolm.nr * this->nhtolm.nc);
784787
syncmem_d2d_h2d_op()(this->d_tab, this->tab.ptr, this->tab.getSize());
785-
syncmem_d2d_h2d_op()(this->d_qq_nt, this->qq_nt.ptr, this->qq_nt.getSize());
788+
if (this->nhm > 0)
789+
{
790+
syncmem_d2d_h2d_op()(this->d_qq_nt, this->qq_nt.ptr, this->qq_nt.getSize());
791+
}
786792
}
787793
else
788794
{
@@ -792,8 +798,11 @@ void pseudopot_cell_vnl::init_vnl(UnitCell& cell, const ModulePW::PW_Basis* rho_
792798
castmem_d2s_h2h_op()(this->s_nhtol, this->nhtol.c, this->nhtol.nr * this->nhtol.nc);
793799
castmem_d2s_h2h_op()(this->s_nhtolm, this->nhtolm.c, this->nhtolm.nr * this->nhtolm.nc);
794800
castmem_d2s_h2h_op()(this->s_tab, this->tab.ptr, this->tab.getSize());
795-
castmem_d2s_h2h_op()(this->s_qq_nt, this->qq_nt.ptr, this->qq_nt.getSize());
796-
castmem_z2c_h2h_op()(this->c_qq_so, this->qq_so.ptr, this->qq_so.getSize());
801+
if (this->nhm > 0)
802+
{
803+
castmem_d2s_h2h_op()(this->s_qq_nt, this->qq_nt.ptr, this->qq_nt.getSize());
804+
castmem_z2c_h2h_op()(this->c_qq_so, this->qq_so.ptr, this->qq_so.getSize());
805+
}
797806
}
798807
// There's no need to synchronize double precision pointers while in a CPU environment.
799808
}

tests/01_PW/CASES_GPU.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ scf_out_elf
1717
013_PW_ONCV_LDA
1818
014_PW_UPF201_BLPS
1919
015_PW_GTH
20-
#016_PW_BLPS
21-
#017_PW_LPS6
22-
#018_PW_LPS8
23-
#019_PW_Coulomb
20+
016_PW_BLPS
21+
017_PW_LPS6
22+
018_PW_LPS8
23+
019_PW_Coulomb
2424
020_PW_kspace
2525
021_PW_kspace3
2626
022_PW_CG
@@ -113,17 +113,17 @@ scf_out_elf
113113
#208_PW_CG_float
114114
209_PW_DFTHALF
115115
210_PW_kspace_shift
116-
#801_PW_LT_sc
117-
#802_PW_LT_fcc
116+
801_PW_LT_sc
117+
802_PW_LT_fcc
118118
#803_PW_LT_bcc
119-
#804_PW_LT_hex
120-
#805_PW_LT_trigonal
121-
#806_PW_LT_st
122-
#807_PW_LT_bct
123-
#808_PW_LT_so
124-
#809_PW_LT_baco
125-
#810_PW_LT_fco
126-
#811_PW_LT_bco
127-
#812_PW_LT_sm
128-
#813_PW_LT_bacm
129-
#814_PW_LT_triclinic
119+
804_PW_LT_hex
120+
805_PW_LT_trigonal
121+
806_PW_LT_st
122+
807_PW_LT_bct
123+
808_PW_LT_so
124+
809_PW_LT_baco
125+
810_PW_LT_fco
126+
811_PW_LT_bco
127+
812_PW_LT_sm
128+
813_PW_LT_bacm
129+
814_PW_LT_triclinic

0 commit comments

Comments
 (0)