Skip to content

Instantly share code, notes, and snippets.

@davydden
Forked from dpo/swig208.rb
Last active August 29, 2015 14:08
Show Gist options
  • Save davydden/3d35ae3e9ae19c12f857 to your computer and use it in GitHub Desktop.
Save davydden/3d35ae3e9ae19c12f857 to your computer and use it in GitHub Desktop.
require 'formula'
class Trilinos < Formula
homepage 'http://trilinos.sandia.gov'
url 'http://trilinos.sandia.gov/download/files/trilinos-11.10.2-Source.tar.gz'
sha1 'f7442cef35c4dea4f3535e0859deda88f68e72fc'
head 'https://software.sandia.gov/trilinos/repositories/publicTrilinos', :using => :git
option "with-teko", "Enable the Teko secondary-stable package"
option "with-shylu", "Enable the ShyLU experimental package"
option "without-check", "Skip build time checks (not recommended)"
option :cxx11
depends_on "cmake" => :build
depends_on "boost" => :recommended
depends_on "scotch" => :optional # Build fails with Scotch.
depends_on "netcdf" => :optional
depends_on "adol-c" => :optional
depends_on "suite-sparse" => :recommended
depends_on "cppunit" => :optional
depends_on "eigen" => :optional
depends_on "glpk" => :optional
depends_on "hdf5" => :optional
depends_on "hwloc" => :optional
depends_on "hypre" => :optional
depends_on "metis" => :optional
depends_on "mumps" => :optional
depends_on "petsc" => :optional
depends_on "parmetis" => :optional
depends_on "scalapack" => :optional
depends_on "superlu" => :optional
depends_on "tbb" => :recommended
depends_on :mpi => [:cc, :cxx, :recommended]
depends_on :fortran => :recommended
depends_on :x11 => :recommended
depends_on :python => :recommended
depends_on "swig208" if build.with? :python
def onoff(s, cond)
s + ((cond) ? "ON" : "OFF")
end
# Fix Sacado tests.
patch :DATA
def install
args = %W[-DBUILD_SHARED_LIBS=ON
-DTPL_ENABLE_BLAS=ON
-DTPL_ENABLE_LAPACK=ON
-DTPL_ENABLE_Zlib:BOOL=ON
-DTrilinos_ENABLE_ALL_PACKAGES=ON
-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES=ON
-DTrilinos_ENABLE_TESTS:BOOL=ON
-DTrilinos_ENABLE_EXAMPLES:BOOL=OFF
-DTrilinos_VERBOSE_CONFIGURE:BOOL=OFF
-DTrilinos_WARNINGS_AS_ERRORS_FLAGS=\"\"
-DCMAKE_INSTALL_PREFIX=#{prefix}
-DCMAKE_BUILD_TYPE=Release
]
args << onoff("-DTPL_ENABLE_MPI:BOOL=", (build.with? :mpi))
args << onoff("-DTrilinos_ENABLE_OpenMP:BOOL=", (ENV.compiler != :clang))
args << onoff("-DTrilinos_ENABLE_CXX11:BOOL=", (build.cxx11?))
# Extra non-default packages
args << onoff("-DTrilinos_ENABLE_ShyLU:BOOL=", (build.with? "shylu"))
args << onoff("-DTrilinos_ENABLE_Teko:BOOL=", (build.with? "teko"))
# Third-party libraries
args << onoff("-DTPL_ENABLE_Boost:BOOL=", (build.with? "boost"))
args << onoff("-DTPL_ENABLE_Scotch:BOOL=", (build.with? "scotch"))
args << onoff("-DTPL_ENABLE_Netcdf:BOOL=", (build.with? "netcdf"))
args << onoff("-DTPL_ENABLE_ADOLC:BOOL=", (build.with? "adol-c"))
args << onoff("-DTPL_ENABLE_AMD:BOOL=", (build.with? "suite-sparse"))
args << onoff("-DTPL_ENABLE_CSPARSE:BOOL=", (build.with? "suite-sparse"))
args << onoff("-DTPL_ENABLE_CHOLMOD:BOOL=", (build.with? "suite-sparse"))
args << onoff("-DTPL_ENABLE_UMFPACK:BOOL=", (build.with? "suite-sparse"))
args << "-DUMFPACK_LIBRARY_NAMES=umfpack;amd;colamd;cholmod;suitesparseconfig" if build.with? "suite-sparse"
args << onoff("-DTPL_ENABLE_CppUnit:BOOL=", (build.with? "cppunit"))
args << onoff("-DTPL_ENABLE_Eigen:BOOL=", (build.with? "eigen"))
args << "-DEigen_INCLUDE_DIRS=#{Formula['eigen'].include}/eigen3" if build.with? "eigen"
args << onoff("-DTPL_ENABLE_GLPK:BOOL=", (build.with? "glpk"))
args << onoff("-DTPL_ENABLE_HDF5:BOOL=", (build.with? "hdf5"))
args << onoff("-DTPL_ENABLE_HWLOC:BOOL=", (build.with? "hwloc"))
args << onoff("-DTPL_ENABLE_HYPRE:BOOL=", (build.with? "hypre"))
args << onoff("-DTPL_ENABLE_METIS:BOOL=", (build.with? "metis"))
args << onoff("-DTPL_ENABLE_MUMPS:BOOL=", (build.with? "mumps"))
args << onoff("-DTPL_ENABLE_PETSC:BOOL=", (build.with? "petsc"))
args << onoff("-DTPL_ENABLE_PARMETIS:BOOL=", (build.with? "parmetis"))
args << onoff("-DTPL_ENABLE_SCALAPACK:BOOL=", (build.with? "scalapack"))
args << onoff("-DTPL_ENABLE_SuperLU:BOOL=", (build.with? "superlu"))
args << onoff("-DTPL_ENABLE_TBB:BOOL=", (build.with? "tbb"))
args << onoff("-DTPL_ENABLE_X11:BOOL=", (build.with? :x11))
args << onoff("-DTrilinos_ENABLE_Fortran=", (build.with? :fortran))
args << onoff("-DTrilinos_ENABLE_PyTrilinos:BOOL=", (build.with? :python))
args << "-DPyTrilinos_INSTALL_PREFIX:PATH=#{prefix}" if build.with? :python
mkdir "build" do
system "cmake", "..", *args
system "make", "VERBOSE=1"
system "ctest" if build.with? "check"
system "make install"
end
end
test do
system "#{bin}/Epetra_BasicPerfTest_test.exe 16 12 1 1 25 -v"
system "mpirun -np 2 #{bin}/Epetra_BasicPerfTest_test.exe 10 12 1 2 9 -v" if build.with? :mpi
system "#{bin}/Epetra_BasicPerfTest_test_LL.exe 16 12 1 1 25 -v"
system "mpirun -np 2 #{bin}/Epetra_BasicPerfTest_test_LL.exe 10 12 1 2 9 -v" if build.with? :mpi
# system "#{bin}/Ifpack2_BelosTpetraHybridPlatformExample.exe" # Missing library!!
system "#{bin}/KokkosClassic_SerialNodeTestAndTiming.exe"
system "#{bin}/KokkosClassic_TPINodeTestAndTiming.exe"
system "#{bin}/KokkosClassic_TBBNodeTestAndTiming.exe" if build.with? "tbb"
system "#{bin}/Tpetra_GEMMTiming_TBB.exe" if build.with? "tbb"
# system "#{bin}/Tpetra_GEMMTiming_TPI.exe" # Fails!!
end
end
__END__
diff --git a/packages/sacado/src/Sacado_MathFunctions.hpp b/packages/sacado/src/Sacado_MathFunctions.hpp
index 37901d4..7853b5f 100644
--- a/packages/sacado/src/Sacado_MathFunctions.hpp
+++ b/packages/sacado/src/Sacado_MathFunctions.hpp
@@ -30,6 +30,7 @@
#ifndef SACADO_MATHFUNCTIONS_HPP
#define SACADO_MATHFUNCTIONS_HPP
+#include <cmath>
#include "Sacado_ConfigDefs.h"
#define UNARYFUNC_MACRO(OP,FADOP) \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment