Skip to content

Commit 6f8bd30

Browse files
committed
update tests
1 parent 43a67cb commit 6f8bd30

File tree

4 files changed

+32
-27
lines changed

4 files changed

+32
-27
lines changed

source/module_pw/pw_distributeg_method2.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ void PW_Basis::distribution_method2()
5151
std::cout << "The first step done\n";
5252
std::cout << "tot_npw " << tot_npw << '\n';
5353
std::cout << "this->nstot " << this->nstot << '\n';
54-
for (int ix = 0; ix < nx; ++ix)
55-
{
56-
for (int iy = 0; iy < ny; ++iy)
57-
{
58-
std::cout << st_length2D[ix * ny + iy] << std::setw(4);
59-
}
60-
std::cout << '\n';
61-
}
54+
// for (int ix = 0; ix < nx; ++ix)
55+
// {
56+
// for (int iy = 0; iy < ny; ++iy)
57+
// {
58+
// std::cout << st_length2D[ix * ny + iy] << std::setw(4);
59+
// }
60+
// std::cout << '\n';
61+
// }
6262
// ------------------------------------------------------------
6363

6464
// (2) Devide the sticks to each core, sticks are in the order of ixy increasing.
@@ -67,7 +67,7 @@ void PW_Basis::distribution_method2()
6767
this->divide_sticks2();
6868
// for test ----------------------------------------------------------------------------
6969
std::cout << "nst_per ";
70-
for (int ip = 0; ip < this->poolnproc; ++ip) std::cout << nst_per[ip] << std::setw(4);
70+
for (int ip = 0; ip < this->poolnproc; ++ip) std::cout << nst_per[ip] << std::setw(10);
7171
std::cout << "\n";
7272
//--------------------------------------------------------------------------------------
7373

@@ -78,7 +78,7 @@ void PW_Basis::distribution_method2()
7878
this->create_maps(st_length2D, npw_per);
7979
// for test ----------------------------------------------------------------------------
8080
std::cout << "npw_per ";
81-
for (int ip = 0; ip < this->poolnproc; ++ip) std::cout << npw_per[ip] << std::setw(4);
81+
for (int ip = 0; ip < this->poolnproc; ++ip) std::cout << npw_per[ip] << std::setw(10);
8282
std::cout << "\n";
8383
//--------------------------------------------------------------------------------------
8484

@@ -137,7 +137,7 @@ void PW_Basis::distribution_method2()
137137
// for test ----------------------------------------------
138138
if (poolrank==0) std::cout << "The fifth step done\n";
139139
// -------------------------------------------------------
140-
ModuleBase::timer::tick("PW_Basis", "distributeg_method1");
140+
ModuleBase::timer::tick("PW_Basis", "distributeg_method2");
141141
return;
142142
}
143143

source/module_pw/pw_transform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ void PW_Basis:: real2recip(std::complex<double> * in, std::complex<double> * out
3737
{
3838
out[ig] = this->ft.aux1[this->ig2isz[ig]];
3939
}
40-
return;
4140
ModuleBase::timer::tick("PW_Basis", "real2recip");
41+
return;
4242
}
4343

4444
//

source/module_pw/unittest/test_t1.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ int main(int argc,char **argv)
5252
//init
5353
pwtest.initgrids(lat0,latvec,wfcecut);
5454
//pwtest.initgrids(lat0,latvec,5,7,7);
55-
pwtest.initparameters(gamma_only,wfcecut,nproc_in_pool,rank_in_pool,1);
55+
// pwtest.initparameters(gamma_only,wfcecut,nproc_in_pool,rank_in_pool,1);
56+
pwtest.initparameters(gamma_only,wfcecut,nproc_in_pool,rank_in_pool,2);
5657
pwtest.setuptransform();
5758
pwtest.collect_local_pw();
5859

@@ -71,8 +72,8 @@ int main(int argc,char **argv)
7172
complex<double> * rhog = new complex<double> [npw];
7273
for(int ig = 0 ; ig < npw ; ++ig)
7374
{
74-
// rhog[ig] = 1.0/(pwtest.gg[ig]+1) + ModuleBase::IMAG_UNIT / (abs(pwtest.gdirect[ig].x+1) + 1);
75-
rhog[ig] = 1.0/(pwtest.gg[ig]+1);
75+
rhog[ig] = 1.0/(pwtest.gg[ig]+1) + ModuleBase::IMAG_UNIT / (abs(pwtest.gdirect[ig].x+1) + 1);
76+
// rhog[ig] = 1.0/(pwtest.gg[ig]+1);
7677
//rhog[ig] = 1.0;
7778
}
7879

@@ -95,11 +96,12 @@ int main(int argc,char **argv)
9596
fftend = clock();
9697
double fftduration = (double)(fftend - fftstart)/CLOCKS_PER_SEC;
9798

98-
cout<<"\n";
99-
cout<<"spend "<<fftduration<<"s\n";
100-
101-
if(rank_in_pool==0) ModuleBase::timer::finish(GlobalV::ofs_running, true);
102-
99+
if(rank_in_pool==0)
100+
{
101+
ModuleBase::timer::finish(GlobalV::ofs_running, true);
102+
cout<<"\n";
103+
cout<<"spend "<<fftduration<<"s\n";
104+
}
103105
if(tmp!=NULL) delete []tmp;
104106
// MPI_Barrier(MPI_COMM_WORLD);
105107
// ProfilerStop();

source/module_pw/unittest/test_t2.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ int main(int argc,char **argv)
5252
//init
5353
pwtest.initgrids(lat0,latvec,wfcecut);
5454
//pwtest.initgrids(lat0,latvec,5,7,7);
55-
pwtest.initparameters(gamma_only,wfcecut,nproc_in_pool,rank_in_pool,1);
55+
// pwtest.initparameters(gamma_only,wfcecut,nproc_in_pool,rank_in_pool,1);
56+
pwtest.initparameters(gamma_only,wfcecut,nproc_in_pool,rank_in_pool,2);
5657
pwtest.setuptransform();
5758
pwtest.collect_local_pw();
5859

@@ -71,8 +72,8 @@ int main(int argc,char **argv)
7172
complex<double> * rhog = new complex<double> [npw];
7273
for(int ig = 0 ; ig < npw ; ++ig)
7374
{
74-
// rhog[ig] = 1.0/(pwtest.gg[ig]+1) + ModuleBase::IMAG_UNIT / (abs(pwtest.gdirect[ig].x+1) + 1);
75-
rhog[ig] = 1.0/(pwtest.gg[ig]+1);
75+
rhog[ig] = 1.0/(pwtest.gg[ig]+1) + ModuleBase::IMAG_UNIT / (abs(pwtest.gdirect[ig].x+1) + 1);
76+
// rhog[ig] = 1.0/(pwtest.gg[ig]+1);
7677
//rhog[ig] = 1.0;
7778
}
7879

@@ -95,10 +96,12 @@ int main(int argc,char **argv)
9596
fftend = clock();
9697
double fftduration = (double)(fftend - fftstart)/CLOCKS_PER_SEC;
9798

98-
cout<<"\n";
99-
cout<<"spend "<<fftduration<<"s\n";
100-
101-
if(rank_in_pool==0) ModuleBase::timer::finish(GlobalV::ofs_running, true);
99+
if(rank_in_pool==0)
100+
{
101+
ModuleBase::timer::finish(GlobalV::ofs_running, true);
102+
cout<<"\n";
103+
cout<<"spend "<<fftduration<<"s\n";
104+
}
102105

103106
if(tmp!=NULL) delete []tmp;
104107
// MPI_Barrier(MPI_COMM_WORLD);

0 commit comments

Comments
 (0)