Skip to content

Use more mpi_f08 features in mpi_f08_test for better detection of valid mpi_f08 module#1202

Merged
mgduda merged 1 commit intoMPAS-Dev:hotfix-v8.2.1from
islas:mpi_f08-enhancedCheck
Jul 17, 2024
Merged

Use more mpi_f08 features in mpi_f08_test for better detection of valid mpi_f08 module#1202
mgduda merged 1 commit intoMPAS-Dev:hotfix-v8.2.1from
islas:mpi_f08-enhancedCheck

Conversation

@islas
Copy link
Contributor

@islas islas commented Jun 28, 2024

Use more mpi_f08 features in mpi_f08_test for odd cases where certain MPI implementations not compiled with mpi_f08 enabled still pass the current check.

Using OpenMPI 4.0.0 and gfortran 11.4.1 compiling without mpi_f08 features the MPI wrapper will still link and supply mpi_f08 (-lmpi_usempif08) despite not being valid or usable. This causes the use mpi_f08 and some features to compile fine, but other mpi_f08 features to not exist and fail compilation.

MPI implementations not compiled with mpi_f08 enabled still pass the check.

Using OpenMPI 4.0.0 and gfortran 11.4.1 compiling without mpi_f08
features the MPI wrapper will still link and supply mpi_f08 (-lmpi_usempif08)
despite not being valid or usable. This causes the `use mpi_f08` and some
features to compile fine, but other mpi_f08 features to not exist and fail
compilation.
@mgduda
Copy link
Contributor

mgduda commented Jul 9, 2024

@islas When you configured OpenMPI, did you add a flag to explicitly disable mpi_f08?

@islas
Copy link
Contributor Author

islas commented Jul 10, 2024

@mgduda Nope, I used --enable-mpi-fortran. From OpenMPI 4.0.0 :

  --enable-mpi-fortran    specify which Fortran MPI bindings to build: yes,
                          none (or no), best-effort, mpifh (build only mpif.h
                          support), usempi (build mpif.h and the mpi module),
                          or usempif08 (or all, build mpifh, the mpi module,
                          and the mpi_f08 module) (default: "yes" if Fortran
                          compiler found)

Though the mpi_f08 module exists in lib/ it fails to compile with :

gfortran -I/home/aislas/dependencies//openmpi/include -I/home/aislas/dependencies//openmpi/lib -Wl,-rpath -Wl,/home/aislas/dependencies//openmpi/lib -Wl,--enable-new-dtags -L/home/aislas/dependencies//openmpi/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -o test_f08 mpi_f08_test.f90 -std=f2008
mpi_f08_test.f90:5:53:

    5 |   type (MPI_Datatype), parameter :: MPI_INTEGERKIND = MPI_INTEGER
      |                                                     1
Error: Parameter ‘mpi_integer’ at (1) has not been declared or is a variable, which does not reduce to a constant expression

Wrapper expanded with -showme and -std=f2008 added to manual compilation of the test program. Given the older version of OpenMPI, it wouldn't surprise me if this is a bug.

Also re-configuring OpenMPI with --enable-mpi-fortran=usempif08 yields the same results.

@mgduda mgduda merged commit 01faa8e into MPAS-Dev:hotfix-v8.2.1 Jul 17, 2024
mgduda added a commit that referenced this pull request Aug 7, 2024
This merge addresses several issues in the MPAS-Atmosphere model and in the MPAS
infrastructure. Specific changes in this merge include:

* Improved detection of an 'mpi_f08' module (PR #1202), as well as improved
  detection of netCDF and PnetCDF library paths (PR #1203), in the top-level
  Makefile.

* The addition of a missing dependency in the physics Makefile to correct
  parallel build issues (PR #1204).

* Fixes to the CMake build files used by MPAS-JEDI (PR #1205).

* Fixes to double-precision builds of MPAS-Atmosphere (PR #1207, PR #1208).

* Correction of the calculation of height AGL used in the computation of 1-km
  radar reflectivity fields (PR #1213).

* Correction of an issue that prevented the MYNN PBL scheme from being used
  without also using the Thompson aerosol-aware microphysics (PR #1215).

* Fixes to allow MPAS-Atmosphere to be built without physics (i.e., dynamics-
  only builds) (PR #1221).

* Various code cleanup and minor corrections (PR #1206, PR #1212, PR #1224,
  PR #1226).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants