forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelemental.rb
130 lines (109 loc) · 4.66 KB
/
elemental.rb
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
class Elemental < Formula
homepage "http://libelemental.org/"
stable do
url "https://github.com/elemental/Elemental/archive/0.85.tar.gz"
sha256 "ccf2b8d3b92e99fb0f248b2c82222bef15a7644d7dc3a2826935216b0bd82d9d"
end
bottle do
revision 1
sha256 "64e4ab14479423b75e2676f70e985605f3eced11ec9d49fa79e61c330d1ad40e" => :yosemite
sha256 "e531728234b0ce946c0dfb64b25222cbebdfac625a5ac38bbc9de6b9954a7037" => :mavericks
sha256 "1fd737518f9f95c7892b1dfa44ffbf44fce71561c3e9c840fdd3a87691f1fbe6" => :mountain_lion
end
devel do
url "https://github.com/elemental/Elemental/archive/0.86-rc1.tar.gz"
sha256 "4f27c55828f27ce1685aaf65018cc149849692b7dfbd9352fc203fed1a96c924"
version "0.86-rc1"
depends_on :python => :recommended
depends_on "metis"
end
head do
url "https://github.com/elemental/Elemental.git"
depends_on "metis"
end
option "without-check", "Skip build time tests (not recommended)"
depends_on "cmake" => :build
depends_on :mpi => [:cc, :cxx, :f90]
depends_on "openblas" => :optional
depends_on "qt5" => :optional
depends_on "scalapack" => :optional
needs :cxx11
def install
ENV.cxx11
args = ["-DCMAKE_INSTALL_PREFIX=#{libexec}", # Lots of junk ends up in bin.
"-DCMAKE_FIND_FRAMEWORK=LAST",
"-DCMAKE_VERBOSE_MAKEFILE=ON",
"-DCMAKE_C_COMPILER=#{ENV["CC"]}",
"-DCMAKE_CXX_COMPILER=#{ENV["CXX"]}",
"-DCMAKE_Fortran_COMPILER=#{ENV["FC"]}",
"-DMPI_C_COMPILER=#{ENV["MPICC"]}",
"-DMPI_CXX_COMPILER=#{ENV["MPICXX"]}",
"-DMPI_Fortran_COMPILER=#{ENV["MPIFC"]}",
"-Wno-dev"]
# Python is disabled in stable because there's no way to
# specify the destination of the Python files.
if build.without? "python"
args << "-DINSTALL_PYTHON_PACKAGE=OFF"
else
args << "-DPYTHON_SITE_PACKAGES=#{libexec}/lib/python2.7/site-packages"
end
if build.head?
args << "-DCMAKE_BUILD_TYPE=Release"
args << ("-DEL_HYBRID=" + ((ENV.compiler == :clang) ? "OFF" : "ON"))
else
args << "-DBUILD_KISSFFT=OFF"
args << ("-DCMAKE_BUILD_TYPE=" + ((ENV.compiler == :clang) ? "Pure" : "Hybrid") + "Release")
end
math_libs = ""
math_libs += "-L#{Formula["scalapack"].opt_lib} -lscalapack " if build.with? "scalapack"
if build.with? "openblas"
math_libs += "-L#{Formula["openblas"].opt_lib} -lopenblas"
else
math_libs += (OS.mac? ? "-framework Accelerate" : "-llapack -lblas -lm")
end
args << "-DMATH_LIBS=#{math_libs}"
# METIS / ParMETIS.
args << "-DBUILD_METIS=OFF"
args += ["-DMANUAL_METIS=ON",
"-DMETIS_ROOT=#{Formula["metis"].opt_prefix}",
"-DMETIS_LIBS=-L#{Formula["metis"].opt_lib} -lmetis",
] if build.devel?
# Building against our own ParMETIS seems borderline impossible
# because of the mess in parmetislib.h.
args += ["-DMETIS_INCLUDE_DIRS=#{Formula["metis"].opt_include}",
"-DMETIS_LIBRARIES=-L#{Formula["metis"].opt_lib} -lmetis",
"-DBUILD_PARMETIS=ON",
# "-DBUILD_PARMETIS=OFF",
# "-DPARMETIS_DIR=#{Formula["parmetis"].opt_libexec}",
# "-DPARMETIS_INCLUDE_DIR=#{Formula["parmetis"].opt_include}",
# "-DPARMETIS_LIB_DIR=#{Formula["parmetis"].opt_lib}",
] if build.head?
# Bundle tests & examples together for check because examples directory
# includes code that exercises Qt5 functionality (via spy plots)
args += ["-DEL_TESTS=ON", "-DEL_EXAMPLES=ON"] if build.with? "check"
args << "-DEL_USE_QT5=ON" if build.with? "qt5"
mkdir "build" do
system "cmake", "..", *args
system "make"
if build.with? "check"
# If running in tmux with Qt5, get the error:
# PasteBoard: Error creating pasteboard: com.apple.pasteboard.clipboard [-4960]
# Seems to be a known issue with Qt running in tmux; see
# https://github.com/ipython/ipython/issues/958.
# To be safe, also mention other terminal multiplexers.
opoo "Qt5 tests may return errors if run in tmux or GNU Screen" if build.with? "qt5"
# Basic smoke test of build for now
system "mpiexec", "-np", "2", "bin/tests/core/AxpyInterface"
# Qt5 test; if enabled, spy plot of matrix will be made; otherwise,
# test merely runs without producing spy plot
system "mpiexec", "-np", "2", "bin/examples/matrices/Legendre"
end
system "make", "install"
ln_sf libexec/"include", include
ln_sf libexec/"lib", lib
end
end
test do
system libexec/"bin/examples/lapack_like/SVD", "--height", "300", "--width", "300"
end
end