Skip to content

Commit e2f6629

Browse files
committed
Temp debug info print
1 parent 5723153 commit e2f6629

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

source/module_hamilt_lcao/hamilt_lcaodft/spar_hsr.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ void sparse_format::cal_HSR(const UnitCell& ucell,
8484
{
8585
ModuleBase::TITLE("sparse_format", "cal_HSR");
8686

87+
int my_rank = 0;
88+
int nproc = 1;
89+
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
90+
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
91+
8792
// sparse_format::set_R_range(HS_Arrays.all_R_coor, grid);
8893

8994
const int nspin = PARAM.inp.nspin;
@@ -99,6 +104,20 @@ void sparse_format::cal_HSR(const UnitCell& ucell,
99104
#ifdef __MPI
100105
// Fix: Sync all_R_coor across processes
101106
sparse_format::sync_all_R_coor(HS_Arrays.all_R_coor, MPI_COMM_WORLD);
107+
108+
//===================== MPI debug =====================//
109+
std::string debug_file = "debug_fix_rank_" + std::to_string(my_rank) + ".log";
110+
std::ofstream fout(debug_file, std::ios::app);
111+
112+
fout << "Process " << my_rank + 1 << "/" << nproc
113+
<< ": HS_Arrays.all_R_coor.size() = " << HS_Arrays.all_R_coor.size() << std::endl;
114+
for (const auto& R: HS_Arrays.all_R_coor)
115+
{
116+
fout << "R = (" << R.x << ", " << R.y << ", " << R.z << ")" << std::endl;
117+
}
118+
fout.close();
119+
MPI_Barrier(MPI_COMM_WORLD);
120+
//===================== debug end =====================//
102121
#endif
103122

104123
if (TD_Velocity::tddft_velocity)

0 commit comments

Comments
 (0)