Compilation error pgc++ with -Mmpi= linking (or nvc++ with -Mmpi= linking)o

I try to compile the pgc++ with MPI application, and I am using the openmpi.

module load mpi/OpenMPI/3.1.4-GCC-8.3.0
module load compiler/PGI/19.10-GCC-8.3.0-2.32

and I see a few options here:

pgc++-Fatal-Switch -Mmpi must have a value
                    Use default or specified MPI communication libraries
    mpich           Use default or MPIDIR-specified MPICH v3.0 libraries
    sgimpi          Use default or MPI_ROOT-specified SGI MPI libraries
    mpich1          DEPRECATED: Use MPIDIR to specify MPICH1 libraries
    mpich2          DEPRECATED: Use MPIDIR to specify MPICH2 libraries
    mvapich1        DEPRECATED: Use MPIDIR to specify MVAPICH1 libraries

And I am using the following compilation option:

pgc++ -fast -Mmpi=mpic++ -Minfo=acc -ta=multicore -acc hello.cpp

afterwards I am getting the following error:

/software/binutils/2.32-GCCcore-8.3.0/bin/ld: hello.o: in function `communicate_fields()':
5/mpi/fields.cpp:130: undefined reference to `ompi_mpi_comm_world'
/software/binutils/2.32-GCCcore-8.3.0/bin/ld: hello.o:(.data+0x88): undefined reference to `MPI::Datatype::Free()'
/software/binutils/2.32-GCCcore-8.3.0/bin/ld: hello.o:(.data+0x568): undefined reference to `MPI::Win::Free()'

Could you please tell me how to link the MPI library with PGI?

Hi kriezh,

The “-Mmpi” flag shouldn’t be used here since you’re not using MPICH. Instead, I recommend using the “mpic++” wrapper script to compile. (See the OpenMPI documentation for details).

Since your OpenMPI isn’t configured for use with pgc++, you’ll want to then set the environment variable " OMPI_MPICXX=pgc++", so mpic++ uses pgc++ instead of g++.

Alternatively, you can use the OpenMPI that ships with the PGI installation (found under $PGI//linux86-64-llvm/2019/mpi/openmpi-3.1.3/) which by default is configured for use with pgc++.

Hope this helps,

Hi Mat,
Thanks a lot! I was able to solve the problem.
Kind regards,

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.