Skip to content

Commit

Permalink
added new packages : tabulate indicators and eigenrand
Browse files Browse the repository at this point in the history
update feelpp with new packages
  • Loading branch information
prudhomm committed Nov 12, 2024
1 parent cff24e1 commit 8985a8f
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 20 deletions.
50 changes: 50 additions & 0 deletions packages/eigenrand/eigenrand-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c863ee9..0df3ccc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -139,6 +139,35 @@ install(TARGETS eigenrand
INCLUDES DESTINATION include
)

+
+# Export EigenRand Targets
+install(EXPORT EigenRandTargets
+ FILE EigenRandTargets.cmake
+ NAMESPACE EigenRand::
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/EigenRand
+)
+
+# Generate EigenRandConfig.cmake and EigenRandConfigVersion.cmake
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/EigenRandConfigVersion.cmake"
+ VERSION ${PROJECT_VERSION}
+ COMPATIBILITY AnyNewerVersion
+)
+
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/EigenRandConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/EigenRandConfig.cmake
+ @ONLY
+)
+
+# Install EigenRandConfig and EigenRandConfigVersion
+install(FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/EigenRandConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/EigenRandConfigVersion.cmake"
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/EigenRand
+)
+
set(CPACK_PACKAGE_NAME "EigenRand-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${EXTRA_VERSION}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "EigenRand-${PROJECT_VERSION}${EXTRA_VERSION}")
set(CPACK_PACKAGE_FILE_NAME "EigenRand-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${EXTRA_VERSION}-${CMAKE_SYSTEM_NAME}")
diff --git a/EigenRandConfig.cmake.in b/EigenRandConfig.cmake.in
new file mode 100644
index 0000000..b76a8d6
--- /dev/null
+++ b/EigenRandConfig.cmake.in
@@ -0,0 +1,3 @@
+@PACKAGE_INIT@
+
+include("${CMAKE_CURRENT_LIST_DIR}/EigenRandTargets.cmake")
\ No newline at end of file
30 changes: 30 additions & 0 deletions packages/eigenrand/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class Eigenrand(CMakePackage):
"""C++ Random Distribution Generator for Eigen."""

homepage = "https://bab2min.github.io/eigenrand/"
url = "https://github.com/bab2min/EigenRand/archive/refs/tags/v0.5.1.tar.gz"
git = "https://github.com/bab2min/EigenRand.git"

maintainers("prudhomm")

license("MIT", checked_by="prudhomm")

version("main", branch="main")
version("0.5.1", sha256="105be932693c0f33398bbec8cd6342e86794d92dad9186d3c8ab46ea0140399f")

patch("eigenrand-cmake.patch", when="@0.5.1:")

depends_on("cxx", type="build")
depends_on("eigen")

def cmake_args(self):
args = ["-DEIGENRAND_BUILD_TEST=OFF", "-DEIGENRAND_BUILD_BENCHMARK=OFF"]
return args
56 changes: 36 additions & 20 deletions packages/feelpp/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Feelpp(CMakePackage, CudaPackage, ROCmPackage):
license("LGPL-3.0-or-later AND GPL-3.0-or-later")

version("develop", branch="develop")
version("preset", branch="2284-add-spack-environment-to-the-main-ci")
version("preset", branch="2284-add-spack-environment-to-the-main-ci", preferred=True)

# Define variants
variant("toolboxes", default=True, description="Enable the Feel++ toolboxes")
Expand All @@ -41,7 +41,7 @@ class Feelpp(CMakePackage, CudaPackage, ROCmPackage):
variant(
"cxxstd", default="20", description="C++ standard", values=["17", "20", "23"], multi=False
)
variant("kokkos", default=True, description="Enable Kokkos support")
variant("kokkos", default=False, description="Enable Kokkos support")
conflicts("^openmpi~cuda", when="+cuda") # +cuda requires CUDA enabled OpenMPI
# Specify dependencies with required versions
depends_on("c", type="build")
Expand All @@ -53,28 +53,36 @@ class Feelpp(CMakePackage, CudaPackage, ROCmPackage):
depends_on(
"[email protected]: +regex+date_time+filesystem+iostreams+mpi+multithreaded+program_options+serialization+shared+system+test"
)
depends_on("cpr")
depends_on("glog")
depends_on("gflags")
depends_on("tabulate")
depends_on("indicators")
depends_on("[email protected] +mumps+hwloc+ptscotch +suite-sparse+hdf5 +hypre~kokkos")
depends_on("slepc")
depends_on("fmt")
depends_on("parmmg")
depends_on("fmt+shared cxxstd=17")
depends_on("cln")
depends_on("eigen")
depends_on("fmi4cpp")
depends_on("fftw")
depends_on("eigenrand")
depends_on("nlopt")
depends_on("ipopt")
depends_on("nanoflann")
depends_on("fmi4cpp@master")
depends_on("matplotplusplus")
depends_on("simple-web-server@master")
depends_on("fftw precision=float,double,long_double +mpi +openmp")
depends_on("gmsh +opencascade+mmg+fltk")
depends_on("libunwind")
depends_on("libzip")
depends_on("curl")
depends_on("bison")
depends_on("flex")
depends_on("pugixml")
depends_on("readline")
depends_on("gsl")
depends_on("glpk")
depends_on("gl2ps")
depends_on("ruby")
depends_on("gmsh +opencascade+mmg+fltk")
depends_on("curl")
depends_on("cpr")
depends_on("glog")
depends_on("gflags")
depends_on("kokkos +threads+hwloc", when="+kokkos")
depends_on("kokkos-kernels", when="+kokkos")

Expand Down Expand Up @@ -109,18 +117,18 @@ class Feelpp(CMakePackage, CudaPackage, ROCmPackage):
# Python dependencies if +python variant is enabled
depends_on("py-pytest", when="+python")
depends_on("py-pandas", when="+python")
depends_on("py-petsc4py", when="+python")
depends_on("py-slepc4py", when="+python")
depends_on("py-petsc4py")
depends_on("py-slepc4py")
depends_on("py-numpy", when="+python")
depends_on("py-pybind11", when="+python")
depends_on("py-sympy", when="+python")
depends_on("py-pybind11")
depends_on("py-sympy")
depends_on("py-plotly", when="+python")
depends_on("py-scipy", when="+python")
depends_on("py-tabulate", when="+python")
depends_on("py-ipykernel", when="+python")
depends_on("py-mpi4py", when="+python")
depends_on("py-mpi4py")
depends_on("py-tqdm", when="+python")
depends_on("[email protected]:3.11", when="+python", type=("build", "run"))
depends_on("[email protected]:3.11", type=("build", "run"))

def get_preset_name(self):
spec = self.spec
Expand Down Expand Up @@ -184,9 +192,17 @@ def install(self, spec, prefix):
cmake = which("cmake")
cmake("--build", "--preset", self.get_preset_name(), "-t", "install")

def test(self, spec, prefix):
ctest = which("ctest")
ctest("--preset", self.get_preset_name(), "-R", "qs_laplacian")
def test_laplacian(self):
# Test the Laplacian example
laplacian_2d = which("feelpp_qs_laplacian_2d")
for case in [ "triangle", "feelpp2d", "square" ]:
laplacian_2d(
"--config-file", f"{self.prefix}/share/feelpp/data/testcases/quickstart/laplacian/cases/{case}/{case}.cfg","--f","1"
)
#
# mpirun = which("mpirun")
# mpirun("-np", "2", self.prefix.bin.feelpp_qs_laplacian_2d, " --config-file", f"{self.prefix}/share/feelpp/data/testcases/quickstart/laplacian/cases/triangle/triangle.cfg")


def setup_run_environment(self, env):
import os
Expand Down
40 changes: 40 additions & 0 deletions packages/indicators/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

# ----------------------------------------------------------------------------
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
# This is a template package file for Spack. We've put "FIXME"
# next to all the things you'll want to change. Once you've handled
# them, you can save this file and test your package like this:
#
# spack install indicators
#
# You can edit this file again by typing:
#
# spack edit indicators
#
# See the Spack documentation for more information on packaging.
# ----------------------------------------------------------------------------

from spack.package import *


class Indicators(CMakePackage):
"""Activity Indicators for Modern C++"""

homepage = "https://github.com/p-ranav/indicators"
url = "https://github.com/p-ranav/indicators/archive/refs/tags/v2.3.tar.gz"
git = "https://github.com/p-ranav/indicators.git"

maintainers("prudhomm")

license("MIT", checked_by="prudhomm")

version("master", branch="master")
version("2.3", sha256="70da7a693ff7a6a283850ab6d62acf628eea17d386488af8918576d0760aef7b")

depends_on("cxx", type="build")
79 changes: 79 additions & 0 deletions packages/nlopt/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class Nlopt(CMakePackage):
"""NLopt is a free/open-source library for nonlinear optimization,
providing a common interface for a number of different free optimization
routines available online as well as original implementations of various
other algorithms."""

homepage = "https://nlopt.readthedocs.io"
url = "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"
git = "https://github.com/stevengj/nlopt.git"

maintainers("cessenat")

license("LGPL-2.1-or-later")

version("master", branch="master")

version("2.9.0", sha256="6e899e297485e457ec1bf84844de29921aeef674f9d5caf60277df45dca6ff76")
version("2.8.0", sha256="e02a4956a69d323775d79fdaec7ba7a23ed912c7d45e439bc933d991ea3193fd")
version("2.7.1", sha256="db88232fa5cef0ff6e39943fc63ab6074208831dc0031cf1545f6ecd31ae2a1a")
version("2.7.0", sha256="b881cc2a5face5139f1c5a30caf26b7d3cb43d69d5e423c9d78392f99844499f")
version("2.6.2", sha256="cfa5981736dd60d0109c534984c4e13c615314d3584cf1c392a155bfe1a3b17e")
version("2.6.1", sha256="66d63a505187fb6f98642703bd0ef006fedcae2f9a6d1efa4f362ea919a02650")
version("2.6.0", sha256="a13077cdf5f5f1127eaaac0bf1e06744bfe98d8a4a3430a15e0af50a69f451ab")
version("2.5.0", sha256="c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae")

depends_on("c", type="build") # generated
depends_on("cxx", type="build") # generated
depends_on("fortran", type="build") # generated

variant("shared", default=True, description="Enables the build of shared libraries")
variant("python", default=True, description="Build python wrappers")
variant("guile", default=False, description="Enable Guile support")
variant("octave", default=False, description="Enable GNU Octave support")
variant("cxx", default=False, description="Build the C++ routines")

# Note: matlab is licenced - spack does not download automatically
variant("matlab", default=False, description="Build the Matlab bindings.")

depends_on("[email protected]:", type="build", when="@master")
depends_on("python", when="+python", type=("build", "run"))
depends_on("py-numpy", when="+python", type=("build", "run"))
depends_on("swig", when="+python")
depends_on("guile", when="+guile")
depends_on("octave", when="+octave")
depends_on("matlab", when="+matlab")
extends("python", when="+python")

def cmake_args(self):
# Add arguments other than
# CMAKE_INSTALL_PREFIX and CMAKE_BUILD_TYPE
spec = self.spec
args = []

# Specify on command line to alter defaults:
# eg: spack install nlopt@master +guile -octave +cxx

# On is default
if "~shared" in spec:
args.append("-DBUILD_SHARED_LIBS:Bool=OFF")

# On is default
if "~octave" in spec:
args.append("-DNLOPT_OCTAVE:Bool=OFF")

if "+cxx" in spec:
args.append("-DNLOPT_CXX:BOOL=ON")

if "+matlab" in spec:
args.append("-DMatlab_ROOT_DIR=%s" % spec["matlab"].command.path)

return args
23 changes: 23 additions & 0 deletions packages/tabulate/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class Tabulate(CMakePackage):
"""tabulate is a header only Table Maker for Modern C++."""

homepage = "https://github.com/p-ranav/tabulate"
url = "https://github.com/p-ranav/tabulate/archive/refs/tags/v1.5.tar.gz"
git = "https://github.com/p-ranav/tabulate.git"

maintainers("prudhomm")

license("MIT", checked_by="prudhomm")

version("master", branch="master")
version("1.5", sha256="16b289f46306283544bb593f4601e80d6ea51248fde52e910cc569ef08eba3fb")

depends_on("cxx", type="build")

0 comments on commit 8985a8f

Please sign in to comment.