I'm using the following code segment to initialize the mpi library for multiple threads. However I always get the following output saying that This MPI implementation does not support MPI_THREAD_MULTIPLE.
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
if(provided != MPI_THREAD_MULTIPLE)
{
fprintf(stderr, "This MPI implementation does not support MPI_THREAD_MULTIPLE.\n"
}
On doing
mpiexec --version and ompi_info
I get this output: mpiexec (OpenRTE) 1.4.3 and Open MPI: 1.4.3
I compile using mpicc mpi_hello.c, where the c file contains the above code section. Any ideas why my mpi library does not support multiple threads? I would like to send and receive mpi messages from different threads, rather than processes.
Thanks
You don't specify which platform or distribution or build you are using. It is likely that the library you are using simply wasn't configured for multi-threaded usage. When building from source, you would need to build it with something like:
$ ./configure --enable-mpi-thread-multiple
You can test which features your binaries have by running:
$ ompi_info | grep -i thread
Thread support: posix (mpi: yes, progress: no)
If it is not supported, you will likely need to build from source.
Please consult the OpenMPI documentation on MPI_Init_Thread
for important details, including information on limitations running in this mode:
Note that
MPI_THREAD_MULTIPLE
support is only lightly tested. It likely does not work for thread-intensive applications. Also note that only the MPI point-to-point communication functions for the BTL’s listed below are considered thread safe. Other support functions (e.g., MPI attributes) have not been certified as safe when simultaneously used by multiple threads.
Note that the version you report (1.4) is also very old; the current stable version is v1.10.
You may want to reconsider your design if you want to use multiple threads; there are several threading frameworks (such as Threaded Building Blocks) more suitable than MPI, which is primarily intended for clustered applications. Some alternatives:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With