Broken compilation: gfortran + OpenMPI + `--enable-mpi_mod` .
When trying to compile octopus 9.1 with gfortran (9.2.1), OpenMPI (4.0.2), and the --enable-mpi_mod
option in the octopus configure script, I get the following error:
$ ./configure <other options> --enable-mpi --enable-mpi_mod
[...]
$ make
[...]
/lib/cpp -C -ffreestanding -I../src/include -I../src/include -I../external_libs/spglib-1.9.9/src -I../liboct_parser -I/usr/include -I/usr/include -DSHARE_DIR='"/home/escartin/research/codes/octopus/releases/use_9.1/share/octopus"' -I../external_libs/metis-5.1/include/ -I. basic/distributed.F90 | \
../build/preprocess.pl - \
"" "yes" "yes" > basic/distributed_oct.f90
mpif90 -O3 -I ../external_libs/bpdn -I ../external_libs/dftd3 -I ../external_libs/spglib-1.9.9/src/ -I /home/escartin/research/codes/libxc/releases/4.3.4/include -I/usr/include -c -o basic/distributed.o basic/distributed_oct.f90
basic/distributed.F90:224:86:
224 | aa(1), this%num(0), displs(0), MPI_FLOAT, this%mpi_grp%comm, mpi_err)
| 1
Error: There is no specific subroutine for the generic ‘mpi_allgatherv’ at (1)
I believe the error is due to the fact that the explicit interfaces provided by the OpenMPI mpi.mod
module allow for TKR mismatches in the MPI buffers but they enforce TKR matches at compilation for all other arguments. E.g., I think the OpenMPI interface for MPI_Allgatherv
can be found in the OpenMPI by-product file ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-interfaces.h
(obtained when compiling OpenMPI with gcc) and is given by
interface MPI_Allgatherv
subroutine MPI_Allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, &
displs, recvtype, comm, ierror)
!GCC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf
type(*), dimension(*), intent(in) :: sendbuf
integer, intent(in) :: sendcount
integer, intent(in) :: sendtype
!GCC$ ATTRIBUTES NO_ARG_CHECK :: recvbuf
type(*), dimension(*) :: recvbuf
integer, dimension(*), intent(in) :: recvcounts
integer, dimension(*), intent(in) :: displs
integer, intent(in) :: recvtype
integer, intent(in) :: comm
integer, intent(out) :: ierror
end subroutine MPI_Allgatherv
end interface
Here, dummy arguments recvcounts
and displs
have both rank 1, but in the problematic octopus file above (basic/distributed_oct.f90
) their corresponding actual arguments (this%num(0)
and displs(0)
) both have rank 0.
I believe there are a few problematic MPI calls like this throughout the octopus code, whose arguments would need to be rewritten in order to fix this.