Skip to content

Commit 8e99806

Browse files
Critsium-xyclaude
andauthored
Refactor: drop source_cell dependency on serialization_cereal (cell->lcao) (#7612)
bcast_cell.cpp included source_lcao/module_ri/serialization_cereal.h only to call ModuleBase::bcast_data_cereal on three ABFS file-name lists, all of which are plain std::vector<std::string>. This created a reverse dependency from source_cell (L1) on source_lcao (L5). Replace the cereal-based broadcast with a small local bcast_string_vector helper built on Parallel_Common::bcast_int/bcast_string, mirroring how ucell.orbital_fn is already broadcast a few lines above. Behaviour is unchanged (broadcast from rank 0 to all ranks); the direct source_cell -> source_lcao include edge is removed. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 4593f9e commit 8e99806

1 file changed

Lines changed: 24 additions & 13 deletions

File tree

source/source_cell/bcast_cell.cpp

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
1-
#include "unitcell.h"
1+
#include "unitcell.h"
22
#include "source_base/parallel_common.h"
33
#include "source_io/module_parameter/parameter.h"
4-
#ifdef __EXX
5-
#include "source_lcao/module_ri/serialization_cereal.h"
6-
#endif
74
#include "source_hamilt/module_xc/exx_info.h" // use GlobalC::exx_info
85

6+
#include <string>
7+
#include <vector>
8+
99
namespace unitcell
1010
{
11+
#if defined(__MPI) && defined(__EXX)
12+
// Broadcast a vector<string> from rank 0 to all ranks.
13+
// Replaces the former cereal-based ModuleBase::bcast_data_cereal, which
14+
// was only ever used here to broadcast plain lists of ABFS file names and
15+
// pulled source_cell into a dependency on source_lcao/module_ri.
16+
static void bcast_string_vector(std::vector<std::string>& v)
17+
{
18+
int size = static_cast<int>(v.size());
19+
Parallel_Common::bcast_int(size);
20+
v.resize(size);
21+
for (int i = 0; i < size; ++i)
22+
{
23+
Parallel_Common::bcast_string(v[i]);
24+
}
25+
}
26+
#endif
27+
1128
void bcast_atoms_tau(Atom* atoms,
1229
const int ntype)
1330
{
@@ -112,15 +129,9 @@ namespace unitcell
112129
}
113130

114131
#ifdef __EXX
115-
ModuleBase::bcast_data_cereal(GlobalC::exx_info.info_ri.files_abfs,
116-
MPI_COMM_WORLD,
117-
0);
118-
ModuleBase::bcast_data_cereal(GlobalC::exx_info.info_opt_abfs.files_abfs,
119-
MPI_COMM_WORLD,
120-
0);
121-
ModuleBase::bcast_data_cereal(GlobalC::exx_info.info_opt_abfs.files_jles,
122-
MPI_COMM_WORLD,
123-
0);
132+
bcast_string_vector(GlobalC::exx_info.info_ri.files_abfs);
133+
bcast_string_vector(GlobalC::exx_info.info_opt_abfs.files_abfs);
134+
bcast_string_vector(GlobalC::exx_info.info_opt_abfs.files_jles);
124135
#endif
125136
return;
126137
#endif

0 commit comments

Comments
 (0)