Skip to content

Commit 7c4410e

Browse files
committed
arrange the order in read_input
1 parent 23fc25e commit 7c4410e

26 files changed

+191
-193
lines changed

source/driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void Driver::reading()
153153
PARAM.inp.bndpar,
154154
GlobalV::KPAR,
155155
GlobalV::NPROC_IN_STOGROUP,
156-
GlobalV::RANK_IN_STOGROUP,
156+
GlobalV::RANK_IN_BPGROUP,
157157
GlobalV::MY_STOGROUP,
158158
GlobalV::NPROC_IN_POOL,
159159
GlobalV::RANK_IN_POOL,

source/module_base/global_file.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,36 +153,32 @@ void ModuleBase::Global_File::make_dir_out(
153153
#endif
154154
}
155155

156-
std::stringstream ss,ss1;
157-
158156
// mohan add 2010-09-12
159157
if(out_alllog)
160158
{
161-
ss << "running_" << calculation << "_" << rank + 1;
162-
open_log(GlobalV::ofs_running, ss.str(), calculation, restart);
159+
open_log(GlobalV::ofs_running, PARAM.globalv.log_file, calculation, restart);
163160
#if defined(__CUDA) || defined(__ROCM)
164-
open_log(GlobalV::ofs_device, "device" + std::to_string(rank), calculation, restart);
161+
open_log(GlobalV::ofs_device, "device" + std::to_string(rank) + ".log", calculation, restart);
165162
#endif
166163
}
167164
else
168165
{
169166
if(rank==0)
170167
{
171-
ss << "running_" << calculation;
172-
open_log(GlobalV::ofs_running, ss.str(), calculation, restart);
168+
open_log(GlobalV::ofs_running, PARAM.globalv.log_file, calculation, restart);
173169
#if defined(__CUDA) || defined(__ROCM)
174-
open_log(GlobalV::ofs_device, "device", calculation, restart);
170+
open_log(GlobalV::ofs_device, "device.log", calculation, restart);
175171
#endif
176172
}
177173
}
178174

179175
if(rank==0)
180176
{
181-
open_log(GlobalV::ofs_warning, "warning", calculation, restart);
177+
open_log(GlobalV::ofs_warning, "warning.log", calculation, restart);
182178
}
183179

184180
#ifdef GATHER_INFO
185-
open_log(GlobalV::ofs_info, "math_info_" + std::to_string(rank), calculation, restart);
181+
open_log(GlobalV::ofs_info, "math_info_" + std::to_string(rank) + ".log", calculation, restart);
186182
#endif
187183

188184
return;
@@ -206,7 +202,7 @@ void ModuleBase::Global_File::open_log(std::ofstream &ofs, const std::string &fn
206202
// PARAM.globalv.global_out_dir : (default dir to store "*.log" file)
207203
//----------------------------------------------------------
208204
std::stringstream ss;
209-
ss << PARAM.globalv.global_out_dir << fn << ".log";
205+
ss << PARAM.globalv.global_out_dir << fn;
210206

211207
if(calculation == "md" && restart)
212208
{

source/module_base/global_variable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int MY_STOGROUP = 0;
2424
int NPROC_IN_POOL = 1; ///< local number of process in a pool
2525
int NPROC_IN_STOGROUP = 1;
2626
int RANK_IN_POOL = 0; ///< global index of pool (count in process), my_rank in each pool
27-
int RANK_IN_STOGROUP = 0;
27+
int RANK_IN_BPGROUP = 0;
2828
int DRANK = -1; ///< mohan add 2012-01-13, must be -1, so we can recognize who
2929
///< didn't in DIAG_WORLD
3030
int DSIZE = KPAR;

source/module_base/global_variable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern int MY_STOGROUP;
3737
extern int NPROC_IN_POOL;
3838
extern int NPROC_IN_STOGROUP;
3939
extern int RANK_IN_POOL;
40-
extern int RANK_IN_STOGROUP;
40+
extern int RANK_IN_BPGROUP;
4141
extern int DRANK;
4242
extern int DSIZE;
4343
extern int DCOLOR;

source/module_base/parallel_global.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void Parallel_Global::init_pools(const int& NPROC,
254254
const int& BNDPAR,
255255
const int& KPAR,
256256
int& NPROC_IN_STOGROUP,
257-
int& RANK_IN_STOGROUP,
257+
int& RANK_IN_BPGROUP,
258258
int& MY_STOGROUP,
259259
int& NPROC_IN_POOL,
260260
int& RANK_IN_POOL,
@@ -269,7 +269,7 @@ void Parallel_Global::init_pools(const int& NPROC,
269269
BNDPAR,
270270
KPAR,
271271
NPROC_IN_STOGROUP,
272-
RANK_IN_STOGROUP,
272+
RANK_IN_BPGROUP,
273273
MY_STOGROUP,
274274
NPROC_IN_POOL,
275275
RANK_IN_POOL,
@@ -317,7 +317,7 @@ void Parallel_Global::divide_pools(const int& NPROC,
317317
const int& BNDPAR,
318318
const int& KPAR,
319319
int& NPROC_IN_STOGROUP,
320-
int& RANK_IN_STOGROUP,
320+
int& RANK_IN_BPGROUP,
321321
int& MY_STOGROUP,
322322
int& NPROC_IN_POOL,
323323
int& RANK_IN_POOL,
@@ -359,15 +359,15 @@ void Parallel_Global::divide_pools(const int& NPROC,
359359
if(BNDPAR > 1)
360360
{
361361
NPROC_IN_STOGROUP = kpar_group.ngroups * bndpar_group.nprocs_in_group;
362-
RANK_IN_STOGROUP = kpar_group.my_group * bndpar_group.nprocs_in_group + bndpar_group.rank_in_group;
362+
RANK_IN_BPGROUP = kpar_group.my_group * bndpar_group.nprocs_in_group + bndpar_group.rank_in_group;
363363
MY_STOGROUP = bndpar_group.my_group;
364-
MPI_Comm_split(MPI_COMM_WORLD, MY_STOGROUP, RANK_IN_STOGROUP, &STO_WORLD);
364+
MPI_Comm_split(MPI_COMM_WORLD, MY_STOGROUP, RANK_IN_BPGROUP, &STO_WORLD);
365365
MPI_Comm_dup(bndpar_group.inter_comm, &PARAPW_WORLD);
366366
}
367367
else
368368
{
369369
NPROC_IN_STOGROUP = NPROC;
370-
RANK_IN_STOGROUP = MY_RANK;
370+
RANK_IN_BPGROUP = MY_RANK;
371371
MY_STOGROUP = 0;
372372
MPI_Comm_dup(MPI_COMM_WORLD, &STO_WORLD);
373373
MPI_Comm_split(MPI_COMM_WORLD, MY_RANK, 0, &PARAPW_WORLD);

source/module_base/parallel_global.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void init_pools(const int& NPROC,
4949
const int& BNDPAR,
5050
const int& KPAR,
5151
int& NPROC_IN_STOGROUP,
52-
int& RANK_IN_STOGROUP,
52+
int& RANK_IN_BPGROUP,
5353
int& MY_STOGROUP,
5454
int& NPROC_IN_POOL,
5555
int& RANK_IN_POOL,
@@ -60,7 +60,7 @@ void divide_pools(const int& NPROC,
6060
const int& BNDPAR,
6161
const int& KPAR,
6262
int& NPROC_IN_STOGROUP,
63-
int& RANK_IN_STOGROUP,
63+
int& RANK_IN_BPGROUP,
6464
int& MY_STOGROUP,
6565
int& NPROC_IN_POOL,
6666
int& RANK_IN_POOL,

source/module_base/test/global_file_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ TEST_F(GlobalFile,mkdiratom)
8080
TEST_F(GlobalFile,openlog)
8181
{
8282
std::ofstream ofs;
83-
ModuleBase::Global_File::open_log(ofs,"Si","md",true);
83+
ModuleBase::Global_File::open_log(ofs,"Si.log","md",true);
8484
EXPECT_TRUE(ofs.is_open());
8585
ofs.close();
86-
ModuleBase::Global_File::open_log(ofs,"Si","md",false);
86+
ModuleBase::Global_File::open_log(ofs,"Si.log","md",false);
8787
EXPECT_TRUE(ofs.is_open());
8888
ofs.close();
8989
std::string sss = "Si.log";

source/module_cell/test/klist_test_para.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ TEST_F(KlistParaTest, Set)
230230
PARAM.input.bndpar,
231231
GlobalV::KPAR,
232232
GlobalV::NPROC_IN_STOGROUP,
233-
GlobalV::RANK_IN_STOGROUP,
233+
GlobalV::RANK_IN_BPGROUP,
234234
GlobalV::MY_STOGROUP,
235235
GlobalV::NPROC_IN_POOL,
236236
GlobalV::RANK_IN_POOL,
@@ -287,7 +287,7 @@ TEST_F(KlistParaTest, SetAfterVC)
287287
PARAM.input.bndpar,
288288
GlobalV::KPAR,
289289
GlobalV::NPROC_IN_STOGROUP,
290-
GlobalV::RANK_IN_STOGROUP,
290+
GlobalV::RANK_IN_BPGROUP,
291291
GlobalV::MY_STOGROUP,
292292
GlobalV::NPROC_IN_POOL,
293293
GlobalV::RANK_IN_POOL,

source/module_elecstate/elecstate_print.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,23 +174,11 @@ void ElecState::print_eigenvalue(std::ofstream& ofs)
174174
{
175175
ModuleBase::WARNING_QUIT("print_eigenvalue", "Eigenvalues are too large!");
176176
}
177-
std::stringstream ss;
178-
if(PARAM.inp.out_alllog)
179-
{
180-
ss << PARAM.globalv.global_out_dir << "running_" << PARAM.inp.calculation << "_" << GlobalV::MY_RANK + 1 << ".log";
181-
}
182-
else
183-
{
184-
ss << PARAM.globalv.global_out_dir << "running_" << PARAM.inp.calculation << ".log";
185-
}
186-
std::string filename = ss.str();
177+
178+
std::string filename = PARAM.globalv.global_out_dir + PARAM.globalv.log_file;
187179
std::vector<int> ngk_tot = this->klist->ngk;
188180

189181
#ifdef __MPI
190-
if(!PARAM.inp.out_alllog)
191-
{
192-
Parallel_Common::bcast_string(filename);
193-
}
194182
MPI_Allreduce(MPI_IN_PLACE, ngk_tot.data(), nks, MPI_INT, MPI_SUM, POOL_WORLD);
195183
#endif
196184

source/module_elecstate/module_charge/charge_init.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
6161
std::stringstream ssc;
6262
ssc << PARAM.globalv.global_readin_dir << "SPIN" << is + 1 << "_CHG.cube";
6363
if (ModuleIO::read_vdata_palgrid(pgrid,
64-
(PARAM.inp.esolver_type == "sdft" ? GlobalV::RANK_IN_STOGROUP : GlobalV::MY_RANK),
64+
(PARAM.inp.esolver_type == "sdft" ? GlobalV::RANK_IN_BPGROUP : GlobalV::MY_RANK),
6565
GlobalV::ofs_running,
6666
ssc.str(),
6767
this->rho[is],
@@ -150,7 +150,7 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
150150
// mohan update 2012-02-10, sunliang update 2023-03-09
151151
if (ModuleIO::read_vdata_palgrid(
152152
pgrid,
153-
(PARAM.inp.esolver_type == "sdft" ? GlobalV::RANK_IN_STOGROUP : GlobalV::MY_RANK),
153+
(PARAM.inp.esolver_type == "sdft" ? GlobalV::RANK_IN_BPGROUP : GlobalV::MY_RANK),
154154
GlobalV::ofs_running,
155155
ssc.str(),
156156
this->kin_r[is],
@@ -223,7 +223,7 @@ void Charge::init_rho(elecstate::efermi& eferm_iout,
223223
std::stringstream ssc;
224224
ssc << PARAM.globalv.global_readin_dir << "SPIN" << is + 1 << "_CHG.cube";
225225
if (ModuleIO::read_vdata_palgrid(pgrid,
226-
(PARAM.inp.esolver_type == "sdft" ? GlobalV::RANK_IN_STOGROUP : GlobalV::MY_RANK),
226+
(PARAM.inp.esolver_type == "sdft" ? GlobalV::RANK_IN_BPGROUP : GlobalV::MY_RANK),
227227
GlobalV::ofs_running,
228228
ssc.str(),
229229
this->rho[is],

0 commit comments

Comments
 (0)