1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# This should really be named Mpich now, but homebrew cannot currently handle
# formula renames, see homebrew issue #14374.
class Mpich2 < Formula
homepage "http://www.mpich.org/"
url "http://www.mpich.org/static/downloads/3.1.4/mpich-3.1.4.tar.gz"
mirror "https://fossies.org/linux/misc/mpich-3.1.4.tar.gz"
sha1 "af4f563e2772d610e57e17420c9dcc5c3c9fec4e"
bottle do
sha1 "96a6ef7dff3f1902790317124ff608c481a2a885" => :yosemite
sha1 "041e7aabd743689d14dd460d1cc290763f820a44" => :mavericks
sha1 "322ea98717bd9cccc060d12f7e4d655c87b601b4" => :mountain_lion
end
head do
url "git://git.mpich.org/mpich.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
devel do
url "http://www.mpich.org/static/downloads/3.2b1/mpich-3.2b1.tar.gz"
sha1 "43ea38cd0007f75adf6ea6db80e823fbfe34a458"
end
deprecated_option "disable-fortran" => "without-fortran"
depends_on :fortran => :recommended
conflicts_with "open-mpi", :because => "both install mpi__ compiler wrappers"
def install
if build.head?
# ensure that the consistent set of autotools built by homebrew is used to
# build MPICH, otherwise very bizarre build errors can occur
ENV["MPICH_AUTOTOOLS_DIR"] = HOMEBREW_PREFIX + "bin"
system "./autogen.sh"
end
args = [
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--mandir=#{man}",
]
args << "--disable-fortran" if build.without? "fortran"
system "./configure", *args
system "make"
system "make", "check"
system "make", "install"
end
test do
(testpath/"hello.c").write <<-EOS.undent
#include <mpi.h>
#include <stdio.h>
int main()
{
int size, rank, nameLen;
char name[MPI_MAX_PROCESSOR_NAME];
MPI_Init(NULL, NULL);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Get_processor_name(name, &nameLen);
printf("[%d/%d] Hello, world! My name is %s.\\n", rank, size, name);
MPI_Finalize();
return 0;
}
EOS
system "#{bin}/mpicc", "hello.c", "-o", "hello"
system "./hello"
system "#{bin}/mpirun", "-np", "4", "./hello"
end
end
|