Skip to content

Refactor: drop source_cell dependency on serialization_cereal (cell->lcao) - #7612

Merged
mohanchen merged 1 commit into
deepmodeling:developfrom
Critsium-xy:refactor/cell-decouple-cereal
Jul 8, 2026
Merged

Refactor: drop source_cell dependency on serialization_cereal (cell->lcao)#7612
mohanchen merged 1 commit into
deepmodeling:developfrom
Critsium-xy:refactor/cell-decouple-cereal

Conversation

@Critsium-xy

@Critsium-xy Critsium-xy commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Background

Part of an incremental effort to untangle the source_* module dependency graph, so that lower layers (data structures) stop depending upward on higher layers (methods). See the module-layering discussion for the broader plan.

source_cell (a foundational L1 data-structure module) currently has several reverse/lateral edges into higher layers. This PR removes one of them: the direct source_cell -> source_lcao include edge.

What this changes

source/source_cell/bcast_cell.cpp included source_lcao/module_ri/serialization_cereal.h only to call ModuleBase::bcast_data_cereal on three ABFS file-name lists:

  • exx_info.info_ri.files_abfs
  • exx_info.info_opt_abfs.files_abfs
  • exx_info.info_opt_abfs.files_jles

All three are plain std::vector<std::string>, so a full cereal (de)serialization round-trip is unnecessary here. This PR replaces those calls 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

Unchanged: still a broadcast from rank 0 to all ranks. Only the transport mechanism (cereal binary archive over MPI_CHAR vs. per-string bcast_string) differs; the resulting data on every rank is identical.

Verification

-fsyntax-only passes in two configurations:

  • default defines (no __EXX)
  • with -D__EXX added

(The only warning emitted is a pre-existing one in source_base/math_erf_complex.h, unrelated to this change.)

Scope note

This removes the direct serialization_cereal.h include. bcast_cell.cpp still transitively reaches source_lcao/module_ri through exx_info.h (which itself pulls in conv_coulomb_pot_k.h); decoupling that is a separate, larger change and is intentionally out of scope here.

…lcao)

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>
@mohanchen mohanchen added Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0 labels Jul 8, 2026
@mohanchen
mohanchen merged commit 8e99806 into deepmodeling:develop Jul 8, 2026
16 of 18 checks passed
@Critsium-xy
Critsium-xy deleted the refactor/cell-decouple-cereal branch July 27, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants