Unify host/node replication naming for WorldContainer and add string-to-enum converters #632
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR unifies the naming scheme for replication-related APIs across
WorldContainerand derived classes, replacing the inconsistent mix of "host" and "node" terminology with standardized "node" and "rank" naming. It also adds string-to-enum converters forDistributionTypeandExchange::Algorithmwith comprehensive normalization support.Motivation
The existing codebase had inconsistent naming:
NodeReplicatedbut the method wasis_host_replicated()Exchange::AlgorithmChanges
1. WorldContainer API Unification
New canonical method names:
Backward compatibility:
All old method names remain as deprecated aliases that forward to the new implementations:
2. DistributionType String Converter
Added
distribution_type_from_string()with case-insensitive normalization:Supported variants for each enum value:
"distributed""rank_replicated","rankreplicated","rank""node_replicated","nodereplicated","node","host_replicated","host"3. Exchange::Algorithm String Converter
Added
Exchange::from_string_algorithm()following the pattern from the problem statement:Supports variants like:
"small_memory","small-memory","smallmemory","small", etc.The deprecated
from_string()wrapper is retained for backward compatibility.4. Testing
Added comprehensive test files:
test_naming_unification.cc- Tests WorldContainer APIs and DistributionType convertertest_algorithm_converter.cc- Tests Exchange::Algorithm converter with all variants5. Documentation
Backward Compatibility
✅ 100% backward compatible - all existing code continues to work with deprecation warnings.
Found 7 usages of deprecated methods in the codebase:
src/madness/mra/funcimpl.h(4 usages)src/madness/mra/macrotaskq.h(1 usage)src/madness/mra/test6.cc(1 usage)src/madness/world/cloud.h(1 usage)These will generate compiler warnings but remain fully functional.
Security
std::invalid_argumenton invalid stringsDesign Rationale
Why "node" over "host"?
NodeReplicatedenum valueWhy class-specific converter names?
from_string()methodsMigration Path
Users can migrate at their convenience:
See
doc/REPLICATION_API_MIGRATION.mdfor detailed migration instructions.Files Changed
src/madness/chem/SCFOperators.h(+46 lines)src/madness/world/worlddc.h(+59 lines)doc/libraries/parallel_runtime.dox(+12 lines)src/madness/chem/test_algorithm_converter.cc(new, 124 lines)src/madness/world/test_naming_unification.cc(new, 154 lines)doc/REPLICATION_API_MIGRATION.md(new, 157 lines)IMPLEMENTATION_NOTES.md(new, 177 lines)Total: +629 lines of production code + tests + documentation
Testing Notes
Syntax has been validated through standalone compilation. Full integration tests require BLAS/MPI environment setup which was not available in the development sandbox, but the changes are minimal, focused, and maintain full backward compatibility.
Original prompt
unify the naming schemes for host/node replication for WorldContainers and derived classes
TITLE:
Unify host/node replication naming for WorldContainer and derived classes
USER INTENT:
Make the naming scheme for "host" vs "node" replication consistent across WorldContainer and all derived classes — update APIs, preserve backward compatibility, and clean up any name collisions with other enum/string converters.
TASK DESCRIPTION:
EXISTING:
PENDING:
CODE STATE:
Files discussed or to be changed (explicitly known or typical locations):
Suggested examples (already-discussed code) — converters and wrapper:
Suggested pattern for WorldContainer renames (example diffs):
Proposed canonical names (pick one st...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.