E3SM-Project / scorpio

A high-level Parallel I/O Library for structured grid applications
Other
21 stars 16 forks source link

Function is_contiguous has no IMPLICIT type with GCC 8 or lower #529

Closed dqwu closed 1 year ago

dqwu commented 1 year ago

With the updated Fortran interface, there are some SCORPIO build errors related to is_contiguous with GCC 8 or lower.

Steps to reproduce on anvil (use GCC 8.2.0)

module purge 
module load cmake/3.20.3-vedypwm gcc/8.2.0-xhxgy33 intel-mpi/2019.9.304-rxpzd6p

git clone https://github.com/E3SM-Project/scorpio.git
cd scorpio

mkdir build
cd build

CC=mpicc CXX=mpicxx FC=mpif90 \
cmake -Wno-dev \
-DWITH_NETCDF=OFF \
-DPnetCDF_PATH=/gpfs/fs1/software/centos7/spack-latest/opt/spack/linux-centos7-x86_64/gcc-8.2.0/parallel-netcdf-1.11.0-fce7akl \
-DPIO_USE_MALLOC=ON \
..

make

Build errors

...
[ 55%] Building Fortran object src/flib/CMakeFiles/piof.dir/spio_darray.F90.o
scorpio/build/src/flib/spio_darray.F90:153:7:

   END INTERFACE
       1
Error: Function ‘is_contiguous’ at (1) has no IMPLICIT type
scorpio/build/src/flib/spio_darray.F90:178:12:

   END INTERFACE
            1
Error: Function ‘is_contiguous’ at (1) has no IMPLICIT type
...

This issue is also reproducible on a Ubuntu 18 workstation with default GCC 7.4.0

It seems that "is_contiguous" (Fortran 2008 or later) is only supported by GCC 9 or higher.

Quite a few E3SM machines still use GCC 8, including mappy, anvil and bebop.

dqwu commented 1 year ago

@jayeshkrishna Besides GNU, we might also need to check other compilers on Fortran 2008 support, see https://fortranwiki.org/fortran/show/Compiler+Support+for+Modern+Fortran https://fortranwiki.org/fortran/show/Fortran+2008+status