class Scalapack < Formula desc "High-performance linear algebra for distributed memory machines" homepage "https://www.netlib.org/scalapack/" url "https://www.netlib.org/scalapack/scalapack-2.0.2.tgz" sha256 "0c74aeae690fe5ee4db7926f49c5d0bb69ce09eea75beb915e00bba07530395c" revision 16 bottle do cellar :any sha256 "2bd0eb0eaa9b0fc85a98fa7785dcd243503961f2711b6dd86cc93d80f84bbe3d" => :catalina sha256 "0d0975114692d302afb2caa38f3e12cc64b37fdad13ce7b41cbbdc6002567d26" => :mojave sha256 "773a7fc4d19e9a9329637d8849bf21b93423b790bb5f0fbe90166ff2d8c19ad2" => :high_sierra sha256 "b52679f06f9f2de153139426ccd949ad5cf6d65814f82a8e2a16dc7bfcf480f6" => :sierra end depends_on "cmake" => :build depends_on "gcc" # for gfortran depends_on "open-mpi" depends_on "openblas" def install mkdir "build" do blas = "-L#{Formula["openblas"].opt_lib} -lopenblas" 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 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