starkiller-astro / weaklib

BSD 3-Clause "New" or "Revised" License
11 stars 4 forks source link

Issue compiling with mpich built with gcc version 10.1.0 #6

Open AstroBarker opened 4 years ago

AstroBarker commented 4 years ago

Compiling the weaklib external libraries (e.g., compiling thornado) using mpich with gcc-10 throws argument mismatch errors on MPI calls. The errors look like:

mpif90 -fopenmp -cpp   -c -DMICROPHYSICS_WEAKLIB -DMOMENT_CLOSURE_ -DNEUTRINO_MATTER_SOLVER_EMAB -DGRAVITY_SOLVER_ -DHYDRO_NONRELATIVISTIC -DHYDRO_RIEMANN_SOLVER_HLL -DUSE_AMREX_FALSE -DTHORNADO_LA_LAPACK -g -framework Accelerate -fbacktrace -ffpe-trap=invalid,zero -ffpe-summary=invalid,zero -fbounds-check -I/usr/local/Cellar/hdf5/1.12.0_1/include  -I/Users/barker/ornl_ut/codes/poseidon/Obj  /Users/barker/ornl_ut/codes/weaklib/Distributions/EOSSource/wlEOSIOModuleHDF.f90
/Users/barker/ornl_ut/codes/weaklib/Distributions/EOSSource/wlEOSIOModuleHDF.f90:300:21:

  263 |     CALL MPI_BCAST( buffer, i_count, MPI_INTEGER, rootproc, COMMUNICATOR, ierr )
      |                    2 
......
  300 |       CALL MPI_BCAST(EOSTable % TS % States(i) % Values(:), EOSTable % nPoints(i), &
      |                     1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(8)/INTEGER(4)).
/Users/barker/ornl_ut/codes/weaklib/Distributions/EOSSource/wlEOSIOModuleHDF.f90:304:19:

  263 |     CALL MPI_BCAST( buffer, i_count, MPI_INTEGER, rootproc, COMMUNICATOR, ierr )
      |                    2
......
  304 |     CALL MPI_BCAST(EOSTable % TS % Names(:), nStates*32,                       &
      |                   1

and so on.

I'm using mpich with gcc-10:

[barker:Executables]$ mpif90 -v                                                                               
mpifort for MPICH version 3.3.2
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin19/10.1.0/lto-wrapper
Target: x86_64-apple-darwin19
Configured with: ../configure --build=x86_64-apple-darwin19 --prefix=/usr/local/Cellar/gcc/10.1.0 --libdir=/usr/local/Cellar/gcc/10.1.0/lib/gcc/10 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-10 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 10.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk SED=/usr/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.1.0 (Homebrew GCC 10.1.0) 

Using open-mpi throws no errors. To get around this I had to add compiler flags -fallow-argument-mismatch. This seems to be a previously noted issue using this mpich (e.g., here, here).

ranchu1 commented 4 years ago

Thank you for bringing this up, @AstroBarker. I looked into the code. And I think it's the compiler's issue. I'm now aware of this issue.