QUICK icon indicating copy to clipboard operation
QUICK copied to clipboard

Update Fortran MPI support

Open agoetz opened this issue 11 months ago • 3 comments

Use of mpif.h is deprecated. Replace

implicit none
include 'mpif.h'

with

use mpi_f08
implicit none

See https://www.mpi-forum.org/docs/mpi-3.1/mpi31-report/node408.htm

agoetz avatar Feb 29 '24 05:02 agoetz

@agoetz I took a stab at this in #328. However, going from the legacy MPI Fortran include directives to using the mpi_f08 module is more involved (see the details in the next paragraph). As a first attempt, the mentioned PR instead changes to the mpi module.

As to converting to mpi_f08 usage, the following issues came up:

  • Some MPI datatypes have changed in the mpi_f08 module. For example, MPI_Status changed from a basic integer datatype to type(MPI_Status).
  • Some variables in QUICK have naming comflicts with variables in the mpi_f08 module. For example, MPI_STATUS in src/modules/quick_mpi_module.F90.
  • It appears that the CMake build system is currently compiling QUICK MPI-specific sources for non-MPI targets. I noticed this when I refactored code to address the above two points. After doing so, I run into build errors with the new QUICK_MPI_STATUS variable in src/modules/quick_mpi_module.F90 is defined as type(MPI_Status). Surrounding with the conditional preprocessor directive MPIV can work around these errors for at least this source file (and maybe other source files using QUICK_MPI_STATUS), but this raises the larger question of why MPIV is needed as a hack to work around build system issues.
  • There may be more issues lurking in MPI routine calls. The current changes in #328 already caught one issue (in src/modules/quick_method_module.f90 -- see src/modules/quick_method_module.f90).

ohearnk avatar Mar 09 '24 16:03 ohearnk

OK, we can change to the mpi module and then work on using mpi_f08 when we have more time.

agoetz avatar Mar 12 '24 22:03 agoetz

I re-opened this issue as a reminder to look into transitioning to mpi_f08 after the release of QUICK-24.03 and AmberTools 24.

agoetz avatar Mar 12 '24 23:03 agoetz