homebrew-core/Formula/scalapack.rb

53 lines
2.1 KiB
Ruby

class Scalapack < Formula
desc "High-performance linear algebra for distributed memory machines"
homepage "http://www.netlib.org/scalapack/"
url "http://www.netlib.org/scalapack/scalapack-2.0.2.tgz"
sha256 "0c74aeae690fe5ee4db7926f49c5d0bb69ce09eea75beb915e00bba07530395c"
revision 9
bottle do
cellar :any
sha256 "93e61a6dc251751dd8e838e102dc4fde5565284dbbc1c4a5e02a577a8493a261" => :high_sierra
sha256 "e87e52207b480cc393cc9797eecbb75407bdc4a7f9a71db7cd5d31c19bd83e12" => :sierra
sha256 "23f8265eeeef16119282d85f1aa5285ca4ed1584c7f5dd933dabee61f737b9ab" => :el_capitan
end
depends_on "cmake" => :build
depends_on :fortran
depends_on :mpi => [:cc, :f90]
depends_on "openblas" => :optional
depends_on "veclibfort" if build.without?("openblas")
def install
if build.with? "openblas"
blas = "-L#{Formula["openblas"].opt_lib} -lopenblas"
else
blas = "-L#{Formula["veclibfort"].opt_lib} -lvecLibFort"
end
mkdir "build" do
system "cmake", "..", *std_cmake_args, "-DBUILD_SHARED_LIBS=ON",
"-DBLAS_LIBRARIES=#{blas}", "-DLAPACK_LIBRARIES=#{blas}"
system "make", "all"
system "make", "install"
end
pkgshare.install "EXAMPLE"
end
test do
ENV.fortran
cp_r pkgshare/"EXAMPLE", testpath
cd "EXAMPLE" do
system "mpif90", "-o", "xsscaex", "psscaex.f", "pdscaexinfo.f", "-L#{opt_lib}", "-lscalapack"
assert `mpirun -np 4 ./xsscaex | grep 'INFO code' | awk '{print $NF}'`.to_i.zero?
system "mpif90", "-o", "xdscaex", "pdscaex.f", "pdscaexinfo.f", "-L#{opt_lib}", "-lscalapack"
assert `mpirun -np 4 ./xdscaex | grep 'INFO code' | awk '{print $NF}'`.to_i.zero?
system "mpif90", "-o", "xcscaex", "pcscaex.f", "pdscaexinfo.f", "-L#{opt_lib}", "-lscalapack"
assert `mpirun -np 4 ./xcscaex | grep 'INFO code' | awk '{print $NF}'`.to_i.zero?
system "mpif90", "-o", "xzscaex", "pzscaex.f", "pdscaexinfo.f", "-L#{opt_lib}", "-lscalapack"
assert `mpirun -np 4 ./xzscaex | grep 'INFO code' | awk '{print $NF}'`.to_i.zero?
end
end
end