0

I have written a package in C++ that is parallelized using MPI. However, since there are so many complicated templates, it will take about half an hour for it to get compiled. Naturally many users have complained about this.

To resolve this I thought the best course of action would be to precompile all of the code. Then bundle all of the shared objects into one, but WITHOUT linking to MPI. The end user will get the shared object according to their platform and link it to implementation of MPI on their system.

However after doing so and taking "nm -B --undefined-only". I saw that there are symbols that are defined only in openmpi (the header files I used were from openmpi), for example ompi_mpi_op_sum or ompi_mpi_int.

Although I use the standard definitions in the header files there are macros that do this:

MPI_Sum-> ompi_mpi_op_sum MPI_Int-> ompi_mpi_int

I looked around the and I could not find anything on the subject. Is there anyway to overcome this? or another solution to this problem?

Lawless
  • 75
  • 1
  • 5
  • Long story short, MPI is a standard at the source level. You cannot let’s say compile your app with MPICH and link it with Open MPI since the standard does not mandate a binary interface. Two versions from the same vendor might not even be binary compatible. – Gilles Gouaillardet Jul 24 '19 at 14:34
  • 2
    This may help: https://stackoverflow.com/questions/38442254/how-to-write-an-mpi-wrapper-for-dynamic-loading – ptb Jul 24 '19 at 15:16

1 Answers1

0

As @ptb pointed out in the comments to question, there is a similar thread that deals with similar subject:

How to write an MPI wrapper for dynamic loading

After reading the thread and doing further research on Bridge design pattern and etc. I found the solution: static PIMPL (see https://www.gamedev.net/articles/programming/general-and-gameplay-programming/static-zero-overhead-probably-pimpl-in-c-r4338/)

I have created a github repository for anyone who has the same problem. It is by no means perfect but I am willing to expand/improve/generalize it upon request.

https://github.com/sinamoeini/mpi_bridge

Lawless
  • 75
  • 1
  • 5