Reputation: 345
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
Upvotes: 4
Views: 4959
Reputation: 20048
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:
Upvotes: 10
Reputation: 13846
Check out MPI's documents on thread support: MPI_THREAD_MULTIPLE support is included if Open MPI was configured with the --enable-mpi-thread-multiple configure switch. You can check the output of ompi_info(1) to see if Open MPI has MPI_THREAD_MULTIPLE support:
shell$ ompi_info | grep -i thread
Thread support: posix (mpi: yes, progress: no)
The "mpi: yes" portion of the above output indicates that Open MPI was compiled with MPI_THREAD_MULTIPLE support.
So checkout ompi_info output on you system, and see if it is supported.
Upvotes: 3