Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MPI support to ParaGrid #560

Merged
merged 25 commits into from
Aug 21, 2024
Merged

Add MPI support to ParaGrid #560

merged 25 commits into from
Aug 21, 2024

Conversation

TomMelt
Copy link
Contributor

@TomMelt TomMelt commented May 21, 2024

Add MPI support to ParaGrid

closes #534
closes #454
closes #448


Task List

  • modify make_init_para24x30.py to use new DG data layout and remove CG vars
  • add MPI doctest support to ParaGrid_test.cpp
  • move extent and start variables into ModelArray's DimensionSpec
  • add special MPI test case to ParaGrid_test.cpp
  • add MPI support to getModelState
  • add MPI support to dumpModelState
  • add MPI support to writeDiagnosticTime
  • reinstate test ConfigOutput_test.cpp for MPI builds
  • add MPI support to ERA5/TOPAZ tests

Change Description

After #331 added MPI parallelisation for thermodynamics on the RectGrid, this PR does the same for the Parametric grid. This should then check off the second task in #120 ("MPI parallelization of thermodynamics where all operations, except for I/O, are local to an MPI rank")


Test Description

  • ParaGrid_test.cpp tests core functionality of ParaGrid (serial and MPI)
  • ./nextsim --config-file config_para24x30.cfg should provide an integration test (serial and MPI) (based on Simple 2D ParametricGrid restart file #506)

Further work (for a future PR)

  • add MPI to dynamics (to close PR MPI parallelization of dynamics #120)
  • implement halo comms
  • implement boundary conditions (as part of MPI)
  • tidy naming of variables in Domain Decomp tool

@TomMelt TomMelt added the ICCS Tasks or reviews for the ICCS team label May 21, 2024
@TomMelt TomMelt self-assigned this May 21, 2024
@TomMelt TomMelt force-pushed the melt-mpi-paragrid branch 2 times, most recently from eb415e0 to d762660 Compare May 23, 2024 17:14
@TomMelt TomMelt added this to the 3 Stand-alone model milestone May 24, 2024
@TomMelt TomMelt changed the title modify paragrid input to new format Add MPI support to ParaGrid May 24, 2024
@TomMelt TomMelt marked this pull request as ready for review June 11, 2024 17:43
@TomMelt TomMelt changed the base branch from develop to main June 12, 2024 09:17
@TomMelt TomMelt changed the base branch from main to develop June 12, 2024 09:17
Copy link
Contributor

@jwallwork23 jwallwork23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @TomMelt! Some initial comments.

core/src/include/ModelArray.hpp Outdated Show resolved Hide resolved
core/src/include/ModelArray.hpp Outdated Show resolved Hide resolved
core/src/include/ParaGridIO.hpp Show resolved Hide resolved
core/src/ParaGridIO.cpp Outdated Show resolved Hide resolved
core/test/ParaGrid_test.cpp Outdated Show resolved Hide resolved
core/test/ParaGrid_test.cpp Outdated Show resolved Hide resolved
core/test/ParaGrid_test.cpp Outdated Show resolved Hide resolved
core/src/include/ModelArray.hpp Show resolved Hide resolved
Comment on lines 57 to 79
struct DimensionSpec {
std::string name;
std::string altName;
size_t length;
size_t global_length;
size_t local_length;
size_t start;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding setters for the new class variables. Setting one member seems fine, but when several are set together (e.g. ModelArray.cpp L211 ff), keeping this with the class itself is preferred.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that you want separate setters for each variable e.g., setDimensionLocalLength, setDimensionGlobalLength?

And by keeping with the class do you mean in the header file i.e., core/src/include/ModelArray.hpp?

Copy link
Contributor Author

@TomMelt TomMelt Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @timspainNERSC , this has now been resolved by f22b88f

core/src/ModelArray.cpp Outdated Show resolved Hide resolved
core/test/ConfigOutput_test.cpp Outdated Show resolved Hide resolved
core/test/ParaGrid_test.cpp Outdated Show resolved Hide resolved
core/test/ParaGrid_test.cpp Outdated Show resolved Hide resolved
core/test/ParaGrid_test.cpp Outdated Show resolved Hide resolved
@timspainNERSC
Copy link
Collaborator

As stated in the README, we follow WebKit style
https://webkit.org/code-style-guidelines/#names-basic

@TomMelt TomMelt force-pushed the melt-mpi-paragrid branch 3 times, most recently from 5c38bc5 to eabb9b1 Compare August 20, 2024 13:44
@TomMelt TomMelt mentioned this pull request Aug 21, 2024
27 tasks
@TomMelt TomMelt force-pushed the melt-mpi-paragrid branch from 50e170b to eb2d3f4 Compare August 21, 2024 08:29
add global_length, local_length, and start variables to
`DimensionSpec`

add logic to assign local dims and start in ParaGridIO

update ParaGrid_test.cpp to handle MPI test

wip: currently only runs for 1 MPI rank
TomMelt added 20 commits August 21, 2024 10:45
add MPI backend and associated test for the IO functionality (get/dump
model state)

This currently passes but I still need to add MPI interface for the
dynamics
* add mpi to ParaGridIO.cpp
* finish mpi test cases for ParaGrid_test.cpp
* reinstate ConfigOutput_test.cpp for MPI builds
* update core/test/CMakeLists.txt to build tests and required input
  files
parallelize ERA5Atm_test and TOPAZOcn_test

update CMakeLists.txt to only build MPI tests when MPI is enabled

only test explicitly using mpi doctest will be built and run under MPI
test run
`ModelArray::definedDimensions` were not set correctly.

This commit sets default global size, local size and start position for
each dimension
time is now the first dimension e.g., `var(time, ydim, xdim)`
@TomMelt TomMelt force-pushed the melt-mpi-paragrid branch from eb2d3f4 to 1ec385a Compare August 21, 2024 08:47
@TomMelt TomMelt merged commit 09dd2b2 into develop Aug 21, 2024
4 checks passed
@TomMelt TomMelt deleted the melt-mpi-paragrid branch August 21, 2024 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ICCS Tasks or reviews for the ICCS team
Projects
Development

Successfully merging this pull request may close these issues.

3 participants