E3SM-Project / E3SM-Project/scorpio
GCC warnings on blanket SAVE statement when MPI Fortran module is disabled
- Dominant language
- C++
- Stars
- 22
- Forks
- 20
- Avg merge
- 12d 19m
- Merged PRs (30d)
- 1
Description
When we configure PIO2 on anlworkstation with GCC 8.2, CMake FindMPI module fails to find expected /soft/apps/packages/climate/mpich/3.2/gcc-8.2.0 (this installed mpich is not supported by softenv so far, a workaround is to use "setenv PATH /soft/apps/packages/climate/mpich/3.2/gcc-8.2.0/bin:$PATH"), and MPI Fortran module is disabled due to verification failure:
```
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- The Fortran compiler identification is GNU 8.2.1
...
-- Found MPI_C: /usr/lib/x86_64-linux-gnu/libmpich.so;/usr/lib/x86_64-linux-gnu/libopa.so;/usr/lib/x86_64-linux-gnu/libmpl.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr/lib/libcr.so;/usr/lib/x86_64-linux-gnu/libpthread.so
-- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/libmpichcxx.so;/usr/lib/x86_64-linux-gnu/libmpich.so;/usr/lib/x86_64-linux-gnu/libopa.so;/usr/lib/x86_64-linux-gnu/libmpl.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr/lib/libcr.so;/usr/lib/x86_64-linux-gnu/libpthread.so
-- Found MPI_Fortran: /usr/lib/x86_64-linux-gnu/libmpichf90.so;/usr/lib/x86_64-linux-gnu/libmpich.so;/usr/lib/x86_64-linux-gnu/libopa.so;/usr/lib/x86_64-linux-gnu/libmpl.so;/usr/lib/x86_64-linux-gnu/librt.so;/usr/lib/libcr.so;/usr/lib/x86_64-linux-gnu/libpthread.so
...
-- Checking whether MPI Fortran module is supported
-- Checking whether MPI Fortran module is supported - no
-- MPI Fortran module failed verification and therefore disabled.
...
```
This configuration without MPI Fortran module is still valid, but there are some build warnings like below:
```
Building Fortran object src/gptl/CMakeFiles/gptl.dir/perf_utils.F90.o
/soft/apps/packages/climate/mpich/3.2/gcc-8.2.0/include/mpif.h:552:11:
SAVE /MPIFCMB5/
1
Warning: Legacy Extension: SAVE statement at (1) follows blanket SAVE statement
/soft/apps/packages/climate/mpich/3.2/gcc-8.2.0/include/mpif.h:553:11:
SAVE /MPIFCMB9/
1
Warning: Legacy Extension: SAVE statement at (1) follows blanket SAVE statement
/soft/apps/packages/climate/mpich/3.2/gcc-8.2.0/include/mpif.h:558:11:
SAVE /MPIPRIV1/,/MPIPRIV2/
1
Warning: Legacy Extension: SAVE statement at (1) follows blanket SAVE statement
/soft/apps/packages/climate/mpich/3.2/gcc-8.2.0/include/mpif.h:561:11:
SAVE /MPIPRIVC/
1
Warning: Legacy Extension: SAVE statement at (1) follows blanket SAVE statement
```
It turns out that there is a blanket SAVE statement in src/gptl/perf_utils.F90, and the above warnings will be triggered when NO_MPIMOD is defined (thus mpif.h is included)
```
!-----------------------------------------------------------------------
!- module boilerplate --------------------------------------------------
!-----------------------------------------------------------------------
implicit none
private ! Make the default access private
save
...
!-----------------------------------------------------------------------
!- include statements --------------------------------------------------
!-----------------------------------------------------------------------
#ifdef NO_MPIMOD
#include
#endif
#include "gptl.inc"
```
This kind of warning is discussed in the following link:
https://marc.info/?l=gcc-fortran&m=130688248420424&w=2
There was a similar issue in PIO before:
https://groups.google.com/forum/#!topic/parallelio/adx6dC--hG8
Is it safe to remove the blanket SAVE statement in perf_utils.F90?
Alternatively, we can keep it but only when NO_MPIMOD is not defined (MPI Fortran module enabled):
```
#ifndef NO_MPIMOD
save
#endif
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.