Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix scotch dependency on mpi #13241

Closed
wants to merge 3 commits into from

3 participants

@wdeconinck

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

@adamv
Owner

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

@Sharpie
Collaborator

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.

@wdeconinck

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.

@Sharpie
Collaborator

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.

@wdeconinck

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

@Sharpie
Collaborator

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.

@Sharpie
Collaborator

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

@wdeconinck

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.

@Sharpie
Collaborator

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.

@Sharpie
Collaborator

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.

@Sharpie
Collaborator

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.

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 Collaborator
Sharpie added a note

This can now be:

depends_on MPIRequirement.new(:cc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Library/Formula/scotch.rb
((7 lines not shown))
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 Collaborator
Sharpie added a note

Can use:

s.change_make_var! 'CCS', ENV['MPICC']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@wdeconinck

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

@Sharpie Sharpie closed this pull request from a commit
@wdeconinck wdeconinck scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
203e28e
@Sharpie Sharpie closed this in 203e28e
@Sharpie
Collaborator

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

@h10n h10n referenced this pull request from a commit
@wdeconinck wdeconinck scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
c8f22ba
@shrop shrop referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@fgeller fgeller referenced this pull request from a commit in fgeller/homebrew
@wdeconinck wdeconinck scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
6ca7fcc
@fgeller fgeller referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@Nexuapex Nexuapex referenced this pull request from a commit
@wdeconinck wdeconinck scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
5c50f85
@ckdaas ckdaas referenced this pull request from a commit in ckdaas/homebrew
@wdeconinck wdeconinck scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2279cf2
@Sharpie Sharpie referenced this pull request from a commit in Sharpie/homebrew
@wdeconinck wdeconinck scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
33ff2be
@snakeyroc3 snakeyroc3 referenced this pull request from a commit in snakeyroc3/homebrew
@wdeconinck wdeconinck scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
f7ad3cd
@sjackman sjackman referenced this pull request from a commit in sjackman/homebrew
@wdeconinck wdeconinck scotch: Depend on MPIDependency
Closes #13241.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
f62886a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 3 deletions.
  1. +13 −3 Library/Formula/scotch.rb
View
16 Library/Formula/scotch.rb
@@ -6,12 +6,22 @@ class Scotch < Formula
version '5.1.12'
md5 'f873ff2bad519f9be7bc7b117bbe0bc4'
+ depends_on MPIDependency.new(:cc)
+
def install
cd 'src' do
ln_s 'Make.inc/Makefile.inc.i686_mac_darwin8', 'Makefile.inc'
- system 'make scotch'
- system 'make ptscotch'
- system "make", "install", "prefix=#{prefix}"
+
+ # Use mpicc to compile everything
+ inreplace 'Makefile.inc' do |s|
+ s.change_make_var! 'CCS', ENV['MPICC']
+ s.change_make_var! 'CCP', ENV['MPICC']
+ s.change_make_var! 'CCD', ENV['MPICC']
+ end
+
+ system 'make', 'scotch'
+ system 'make', 'ptscotch'
+ system 'make', 'install', "prefix=#{prefix}"
end
end
end
Something went wrong with that request. Please try again.