Skip to content

Instantly share code, notes, and snippets.

@mseri
Created August 23, 2019 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mseri/60d26461b764e77b45d82ad7f0b0d7de to your computer and use it in GitHub Desktop.
Save mseri/60d26461b764e77b45d82ad7f0b0d7de to your computer and use it in GitHub Desktop.
Homebrew formula to install Sundials3 for sundialsml
class Sundials3 < Formula
desc "Nonlinear and differential/algebraic equations solver"
homepage "https://computation.llnl.gov/casc/sundials/main.html"
url "https://computing.llnl.gov/projects/sundials/download/sundials-3.2.1.tar.gz"
version "3.2.1"
sha256 "47d94d977ab2382cdcdd02f72a25ebd4ba8ca2634bbb2f191fe1636e71c86808"
revision 1
depends_on "cmake" => :build
depends_on "gcc" # for gfortran
depends_on "open-mpi"
depends_on "openblas"
depends_on "suite-sparse"
def install
blas = "-L#{Formula["openblas"].opt_lib} -lopenblas"
args = std_cmake_args + %W[
-DCMAKE_C_COMPILER=#{ENV["CC"]}
-DBUILD_SHARED_LIBS=ON
-DKLU_ENABLE=ON
-DKLU_LIBRARY_DIR=#{Formula["suite-sparse"].opt_lib}
-DKLU_INCLUDE_DIR=#{Formula["suite-sparse"].opt_include}
-DLAPACK_ENABLE=ON
-DBLA_VENDOR=OpenBLAS
-DLAPACK_LIBRARIES=#{blas};#{blas}
-DMPI_ENABLE=ON
]
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
end
test do
cp Dir[prefix/"examples/nvector/serial/*"], testpath
system ENV.cc, "-I#{include}", "test_nvector.c", "sundials_nvector.c",
"test_nvector_serial.c", "-L#{lib}", "-lsundials_nvecserial"
assert_match "SUCCESS: NVector module passed all tests",
shell_output("./a.out 42 0")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment