Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added MPI_THREAD_MULTIPLE Support to OpenMPI ./configure step. #16956

Closed
wants to merge 1 commit into from

4 participants

@XL64

Added the possibility to enable MPI_THREAD_MULTIPLE support with OpenMPI.

@samueljohn

What does that flag do? (I am not so familiar with mpi)

@XL64

Without this flag you cannot use threads in your MPI program.

I'll try to explain more precisely :

MPI allows different type of thread support.

from this doc : http://www.mpi-forum.org/docs/mpi-20-html/node165.htm

{ MPI_THREAD_SINGLE}
Only one thread will execute.
{ MPI_THREAD_FUNNELED}
The process may be multi-threaded, but only the main thread will make MPI calls (all MPI calls are funneled'' to the > main thread).
{ MPI_THREAD_SERIALIZED}
The process may be multi-threaded, and multiple threads may make MPI calls, but only one at a time: MPI calls are > not made concurrently from two distinct threads (all MPI calls are
serialized'').
{ MPI_THREAD_MULTIPLE}
Multiple threads may call MPI, with no restrictions.

If --enable-thread-multiple is not set, it will always provide MPI_THREAD_SINGLE.

Thus, you can't use threads with your MPI programs.

@samueljohn
@samueljohn

@adamv I tested this and it builds. I compiled homebrew-science/lammps --with-mpi and all seems to work as expected. Any other opinions?

@mikemcquaid
Owner

Seems reasonable. Any reason this option shouldn't be default?

@XL64

Except its not default for OpenMPI, I see no reason, I always build MPI with maximum thread support as I need it for my developments, and I rarely had problems with OpenMPI thread support, it's safe as far as I know.

Maybe it's something historical for them as the first MPI library only supported MPI_THREAD_SINGLE, and MPI_THREAD_MULTIPLE was brought as an option.

Maybe THREAD_MULTIPLE induces some overhead (mutex are required for example) and this is why it's not default for OpenMPI team.

@samueljohn

Not sure. But lets stick to OpenMPI's default. Code that already spawns n mpi main threads for a n-core machine might get significantly slower, if each of the n threads has multiple sub-threads, right?
(However, I no expert on mpi)

@manphiz
Collaborator

FWIW, Macports provides a similar switch (threads) for this: https://trac.macports.org/browser/trunk/dports/science/openmpi/Portfile.

@XL64

I think that people launching MPI+Threads tools know what they are doing and won't launch too much MPI process and threads but sticking to OpenMPI's default is not a bad idea as they are the experts.

@samueljohn

Let's pull this in.

@mikemcquaid
Owner

Yep, works for me. I'll pull it when I'm back from holiday or another maintainer should feel free before then.

@mikemcquaid mikemcquaid closed this pull request from a commit
Xavier Lacoste open-mpi: add MPI_THREAD_MULTIPLE support.
Closes #16956.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
0c7abfe
@norioxkimura norioxkimura referenced this pull request from a commit in norioxkimura/homebrew
Xavier Lacoste open-mpi: add MPI_THREAD_MULTIPLE support.
Closes #16956.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
3fc96f9
@cooljeanius cooljeanius referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@rajeeja rajeeja referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 8, 2013
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 Library/Formula/open-mpi.rb
View
5 Library/Formula/open-mpi.rb
@@ -15,6 +15,7 @@ class OpenMpi < Formula
option 'disable-fortran', 'Do not build the Fortran bindings'
option 'test', 'Verify the build with make check'
+ option 'enable-mpi-thread-multiple', 'Enable MPI_THREAD_MULTIPLE'
def install
args = %W[
@@ -28,6 +29,10 @@ def install
ENV.fortran
end
+ if build.include? 'enable-mpi-thread-multiple'
+ args << '--enable-mpi-thread-multiple'
+ end
+
system './configure', *args
system 'make V=1 all'
system 'make V=1 check' if build.include? 'test'
Something went wrong with that request. Please try again.