fix scotch dependency on mpi #13241

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

wdeconinck commented Jul 6, 2012

The scotch formula requires mpi.
Since open-mpi no longer comes with Lion, I added explicit dependency on open-mpi

Contributor

adamv commented Jul 6, 2012

Possibly should be conditionally applied, since I can still compile it on Snow Leopard without this.

Contributor

Sharpie commented Jul 6, 2012

We also have MPICH2 which provides mpicc---so we cant be using depends_on 'open-mpi' anymore since it could run roughshod over MPICH2 users.

Contributor

wdeconinck commented Jul 6, 2012

This is a good point.
How about the Snow Leopard users that have a system openmpi, and wish to use mpich2?

Maybe we should check for existence of mpiexec in the path.

Then, if there is none available, fail, and ask to try again after installing either open-mpi or mpich2

The CC and CXX compilers should then be set to respectively mpicc and mpicxx, so that the correct linking occurs.

Contributor

Sharpie commented Jul 6, 2012

I'm working on drafting up a Requirement that should solve this:

depends_on MPIRequirement.new(:cc, :cxx, :f90)

That would ensure mpicc, mpicxx and mpif90 are all available and working and if not, prompt the user to install open-mpi or mpich2.

Contributor

wdeconinck commented Jul 6, 2012

Sounds really good!
I noticed a few other formula's will need to adapt to this as well.

Contributor

Sharpie commented Jul 6, 2012

Yeah, it's also been on my TODO list for a bit as there is some stuff in homebrew-science that needs it as well.

Contributor

Sharpie commented Jul 6, 2012

The CC and CXX compilers should then be set to respectively mpicc and mpicxx, so that the correct linking occurs.

I don't think this is a good idea to do in general. Scotch may be expecting CC and CXX to be set to mpicc and mpicxx, but there are plenty of programs that compile both MPI and non-MPI components in the same build.

The best way to go would probably be to define MPICC, MPICXX, MPIFC and MPIF77 as documented by the autoconf macros for MPI:

http://ac-archive.sourceforge.net/ac-archive/acx_mpi.html

Contributor

wdeconinck commented Jul 6, 2012

Why I mentioned this is because we should be careful that $CC and $MPICC are in fact the same compiler.
If mpicc is built using llvm-gcc (only option for now for open-mpi 1.6), and then installing another formula depending (partially even) on mpi, it should be built using the same base compiler, in this case llvm-gcc.
Since it doesn't hurt to use mpicc as a non-MPI component compiler, this was a suggestion, avoiding more complex solutions.

Contributor

Sharpie commented Jul 6, 2012

That is a good point---but on the other hand we are well and truly fucked if stuff built with clang,llvm-gcc and gcc can't be cross-linked.

Contributor

Sharpie commented Jul 6, 2012

Proposed MPIDependency in #13255. It doesn't cover all bases, such as how to handle fails_with in relation to MPI compilers or formula like abyss that do different things depending on if Open-MPI or MPICH2 is used. But, I am pretty confident that this approach handles the open-mpi/mpich2/system open-mpi split more elegantly than depends_on 'open-mpi' without introducing any new bugs.

Contributor

Sharpie commented Jul 28, 2012

Allright, MPIDependency is now merged. Sorry about the delay---we discovered some Requirement code that was getting really ugly and took some time to fix it.

@Sharpie Sharpie commented on an outdated diff Jul 28, 2012

Library/Formula/scotch.rb
@@ -6,11 +6,21 @@ class Scotch < Formula
version '5.1.12'
md5 'f873ff2bad519f9be7bc7b117bbe0bc4'
+ # Snow Leopard comes with mpi but Lion does not
+ depends_on 'open-mpi' if MacOS.lion?
@Sharpie

Sharpie Jul 28, 2012

Contributor

This can now be:

depends_on MPIRequirement.new(:cc)

@Sharpie Sharpie commented on an outdated diff Jul 28, 2012

Library/Formula/scotch.rb
def install
cd 'src' do
ln_s 'Make.inc/Makefile.inc.i686_mac_darwin8', 'Makefile.inc'
- system 'make scotch'
- system 'make ptscotch'
+
+ # Don't use gcc as defined in the Makefile.inc, but use
+ # mpicc, so that there is consistency with the mpi distro
+ inreplace 'Makefile.inc' do |s|
+ s.change_make_var! "CCS", "mpicc"
@Sharpie

Sharpie Jul 28, 2012

Contributor

Can use:

s.change_make_var! 'CCS', ENV['MPICC']
Contributor

wdeconinck commented Jul 29, 2012

Adapted to your recommendations. Note I had to force-push after rebasing the master.

Sharpie closed this in 203e28e Jul 29, 2012

Contributor

Sharpie commented Jul 29, 2012

Pulled. I squashed all the commits into one since this is really one logical change: adding a MPI dependency to scotch.

@fgeller fgeller added a commit to fgeller/homebrew that referenced this pull request Aug 22, 2012

@wdeconinck @fgeller wdeconinck + fgeller scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
6ca7fcc

@Sharpie Sharpie added a commit to Sharpie/homebrew that referenced this pull request Sep 12, 2012

@wdeconinck @Sharpie wdeconinck + Sharpie scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
33ff2be

@snakeyroc3 snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this pull request Dec 17, 2012

@wdeconinck @Sharpie wdeconinck + Sharpie scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
f7ad3cd

@sjackman sjackman pushed a commit to sjackman/homebrew that referenced this pull request Nov 15, 2013

@wdeconinck @Sharpie wdeconinck + Sharpie scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
f62886a

xu-cheng locked and limited conversation to collaborators Feb 16, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.