Skip to content

Commit 4941bad

Browse files
committed
fix test
1 parent 6059cf0 commit 4941bad

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

source/module_hsolver/diago_bpcg.cpp

100644100755
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,16 @@ void DiagoBPCG<T, Device>::init_iter(const int nband, const int nband_l, const i
7070
template<typename T, typename Device>
7171
bool DiagoBPCG<T, Device>::test_error(const ct::Tensor& err_in, const std::vector<double>& ethr_band)
7272
{
73-
const Real * _err_st = err_in.data<Real>();
73+
Real* _err_st = err_in.data<Real>();
7474
bool not_conv = false;
75+
std::vector<Real> tmp_cpu;
7576
if (err_in.device_type() == ct::DeviceType::GpuDevice) {
76-
ct::Tensor h_err_in = err_in.to_device<ct::DEVICE_CPU>();
77-
_err_st = h_err_in.data<Real>();
77+
// ct::Tensor h_err_in = err_in.to_device<ct::DEVICE_CPU>();
78+
// _err_st = h_err_in.data<Real>();
79+
// qianrui change it, because it can not pass the valgrind test
80+
tmp_cpu.resize(this->n_band_l);
81+
_err_st = tmp_cpu.data();
82+
syncmem_var_d2h_op()(_err_st, err_in.data<Real>(), this->n_band_l);
7883
}
7984
for (int ii = 0; ii < this->n_band_l; ii++) {
8085
if (_err_st[ii] > ethr_band[ii]) {
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
etotref -4869.74705201
2-
etotperatomref -2434.87352600
3-
totalforceref 5.19522000
4-
totalstressref 37241.49490600
1+
etotref -4869.7470520063843651
2+
etotperatomref -2434.8735260032
3+
totalforceref 5.194830
4+
totalstressref 37241.448435
55
pointgroupref C_1
66
spacegroupref C_1
77
nksibzref 8
8-
totaltimeref 10.37
8+
totaltimeref 5.53

0 commit comments

Comments
 (0)