mpi_ is prepended to symbol name--link to MPI lib fails

I have a problem linking a specific MPI code. The symbol names for the MPI routines are having “mpi_” prepended to them so they’re not being found in the MPI libs. Other MPI codes and simple examples link OK.

E.g.

mpif90 -O3 -o ns dfd_bound.o dfd_ns.o dfd_data.o dfd_disc.o dfd_fv.o dfd_geom.o dfd_input.o dfd_jacob.o dfd_library.o dfd_linear.o dfd_main.o dfd_output.o dfd_precon.o dfd_state.o dfd_type.o dfd_turb.o dfd_reaction.o dfd_source.o dfd_rptbdb.o
dfd_bound.o(.text+0xc7): In function `dfd_bound_set_boundary_':
: undefined reference to `mpi_mpi_comm_rank_'

I find the symbol mpi_comm_rank_ in several libs in /opt/hpmpi/lib/linux_amd64, but I’m getting an error because mpi_ is being prepended to the name.

libdmpi.so:000000000006e940 W mpi_comm_rank_
libhpmpi.so:00000000000b9e00 W mpi_comm_rank_
libmpi_hmp.so:00000000000b9e00 W mpi_comm_rank_
libmpi.so:00000000000b9e00 W mpi_comm_rank_
libmtmpi_hmp.so:000000000008b540 W mpi_comm_rank_
libmtmpi.so:000000000008b540 W mpi_comm_rank_

Hi Bill,

Prepending your function names with “mpi_” is not something the pgf90 compiler would do. So I suspect that your code or your mpif90 script has a macro which defines “MPI_COMM_RANK” to be “MPI_MPI_COMM_RANK”.

In the function “dfd_bound_set_boundary”, is MPI_COMM_RANK actually used, or is there a macro used instead? Is MPI_COMM_RANK re-defined as a macro in any of your header files? (try ‘grep -Hi MPI_COMM_RANK *.h’)

Thanks,
Mat