NCAR / DART

Data Assimilation Research Testbed
https://dart.ucar.edu/
Apache License 2.0
189 stars 142 forks source link

Feature request: Reduce memory usage for forward operators MPI window #718

Open hkershaw-brown opened 1 month ago

hkershaw-brown commented 1 month ago

Use case

Currently doing an copy of data from the ensemble handle to the window

Is your feature request related to a problem?

Not incorrect results, but using more memory per core than we need to.

Describe your preferred solution

Create the window with the whole state_ens_handle%copies array. 'simply contiguous' 1 get_state copies_in_window != copies you need to get so the window logic would need to be updated for the whole %copies array

  1. MPI_Win_create In Fortran, one can pass the first element of a memory region or a whole array, which must be 'simply contiguous' (for 'simply contiguous', see also MPI 3.0, Section 17.1.12 on page 626). https://www.mpi-forum.org/docs/mpi-3.1/mpi31-report.pdf

Spec

Describe any alternatives you have considered

None

hkershaw-brown commented 1 month ago

this is an aside, but there are unused copies_in_window in CM1 model_mod & filter_mod (& filter_dopplerfold) https://github.com/NCAR/DART/blob/75cf8dc9c566221f624ffd4d5eeba9fde5a1757c/models/cm1/model_mod.f90#L59 https://github.com/NCAR/DART/blob/75cf8dc9c566221f624ffd4d5eeba9fde5a1757c/assimilation_code/modules/assimilation/filter_mod.f90#L49

pull these out.

hkershaw-brown commented 1 month ago

note this is why there is a copy:

! Global memory to stick the mpi window to.
! Need a simply contiguous piece of memory to pass to mpi_win_create
! Openmpi 1.10.0 will not compile with ifort 16 if
! you create a window with a 2d array.

https://github.com/NCAR/DART/blob/75cf8dc9c566221f624ffd4d5eeba9fde5a1757c/assimilation_code/modules/utilities/no_cray_win_mod.f90#L43C1-L46C39