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.


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. W mpi_comm_rank_ W mpi_comm_rank_ W mpi_comm_rank_ W mpi_comm_rank_ W mpi_comm_rank_ 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’)