Howto compile MPI application in “serial” mode (wi

2019-08-06 23:29发布

问题:

This question might sound a bit weird...

Imagine I have an MPI application, but I don't have a system with MPI installed. So I want to compile the application with no MPI support (1-process, 1-thread) without modifying source code. Is that possible?

I found somewhere a "mimic_mpi.h" wrapper which is supposed to do exactly what I want. But there were some MPI functions missing in there (e.g., MPI_Cart_create, MPI_Cart_get, etc.), so I didn't succeed.

mimic_mpi.h http://openmx.sourcearchive.com/documentation/3.2.4.dfsg-3/mimic__mpi_8h-source.html

mimic_mpi.c http://openmx.sourcearchive.com/documentation/3.2.4.dfsg-3/mimic__mpi_8c-source.html

Do you know any other approach I could use to compile MPI apps with no MPI support?

Thanks in advance!

回答1:

You can run a "real" MPI application easily with a single process. In practice this even works without using mpiexec/mpirun although I'm not sure if that's officially supported. That said a full and confirming 1-process MPI "serial" implementation would probably become rather complex and its own library - so in that case, why not just use a real full MPI implementation?

I hope you see the circle I'm trying to draw: If you want full MPI behavior, just use an MPI implementation - regardless if it's just limited to a single process.

In practice, applications that want to be able to function with or without MPI often seem to use their own MPI abstractions using domain specific communication wrappers, #ifdef HAVE_MPI or more complex macros.



标签: mpi openmpi