Using MPI_IN_PLACE in PGI Windows

Having trouble running an application using MPI_IN_PLACE. Am using PGI 15.1 and HPC Pack 2012 R2 MS-MPI via Cygwin. My code is as follows:

$ more simple_test.f
      program main
      implicit none
      integer:: my_proc,ncells,ierr
      include 'mpif.h'

      call mpi_init(ierr)
      call mpi_comm_rank(mpi_comm_world, my_proc, ierr)


      call mpi_allreduce(mpi_in_place, ncells, 1, mpi_integer,
     &                   mpi_sum, mpi_comm_world, ierr)

      print *,'num cells', ncells,my_proc
      call flush(6)

      call mpi_barrier(mpi_comm_world,ierr)
      call mpi_finalize(ierr)
      end program

My compile script (shows where is placed MS-MPI directory) …


MPIW=`cygpath -w "/usr/local/MS-MPI"`

Libs="-L $MPIW/Lib/amd64 msmpi.lib msmpifec.lib"
echo " Libs="  $Libs
IncFlags="-I $MPIW/Inc -I$MPIW/Inc/amd64"

pgf90 -Mextend $IncFlags -o test-pgi.exe simple_test.f $Libs

When running I am getting incorrect results as if MPI_IN_PLACE is
being treated as local variable with initial value of zero instead.

$ /usr/local/MS-MPI/Bin/mpiexec.exe -n 4 ./test-pgi.exe
num cells 0 0
num cells 0 1
num cells 0 2
num cells 0 3

Is there a fix to this?


I was able to find a reference to this with Intel fortan.
The correction was to recompile everything with /Qlowercase
set. This suggests the problem is with an external reference that
has upper case characters in it, and most fortran compilers (internally)
convert everything to lower case before compiling.

I think this much like our

switch, but I would also try

to see what happens.


I tried the case sensitive compilation options as suggested but this did not
seem to help.

pgf90 -Mnoupcase -Mextend $IncFlags -o test-pgi.exe simple_test.f $Libs

… yields same problematic results

pgf90 -Mupcase -Mextend $IncFlags -o test-pgi.exe simple_test.f $Libs

… yields compilation errors (not sure at what stage but has to do with
capitalization all thru mpif.h

PGF90-S-0034-Syntax error at or near end of line (C:\cygwin\usr\local\MS-MPI/Inc\mpif.h: 8)
PGF90-S-0034-Syntax error at or near end of line (C:\cygwin\usr\local\MS-MPI/Inc\mpif.h: 9)
PGF90-S-0034-Syntax error at or near end of line (C:\cygwin\usr\local\MS-MPI/Inc\mpif.h: 10