PGF90-S-0155-Could not resolve generic procedure mpi_scatter

I’m currently wondering what I’m doing wrong. It’s been a while since I’ve done some MPI programming and so I decided to start out with a simple example of MPI_SCATTER to make sure I remembered what I’m doing. To wit, I wrote this rather awful program:

program scattertest

   use mpi

   implicit none

   integer, parameter :: m = 4
   integer, parameter :: np = 6

   integer :: a(m,np), b(m,np)
   integer :: alocal(m/2,np), blocal(m/2,np)
   integer :: ierr, total, rank
   integer :: msize, i, j, k

   call mpi_init(ierr)
   call mpi_comm_size(MPI_COMM_WORLD, total, ierr)
   call mpi_comm_rank(MPI_COMM_WORLD, rank, ierr)

   write (*, *) "I am process ", rank, " of ", total

   if (rank == 0) then
      do i=1,m
         a(i,:)=i
      end do
   end if

   write (*,*) a(1,:)

   call mpi_scatter(a,2*6,MPI_INTEGER,&
                    alocal,2*6,MPI_INTEGER,&
                    0,MPI_COMM_WORLD,ierr)

   write (*,*) alocal(1,:)

   call mpi_finalize(ierr)
end program scattertest

I’m only trying to run this on 2 processors at the moment, thus I’ve sort of hardwired in some constants. However, when I try to compile this:

> mpif90 scattertest.f90
PGF90-S-0155-Could not resolve generic procedure mpi_scatter (scattertest.f90: 29)
  0 inform,   0 warnings,   1 severes, 0 fatal for scattertest

I’m not too sure how to interpret that error. (Oh, and I suppose if I have the MPI code completely wrong, speak up there as well.)

Answering myself, it looks like the reason is the strong-typing of Fortran 90. If one instead uses “include ‘mpif.h’” rather than “use mpi”, the behavior I’m used to returns.

Hi Matt,

The type mismatch is because you’re using multidimensional arrays which MPI_SCATTER is expecting a single dimension. Either you need to reshape the array or not use mpi.mod. With “mpi.h”, you’re using F77 calling conventions so only a pointer is passed to MPI_SCATTER.

  • Mat