tamaas: adding new versions and python install fix (#44469)

* tamaas: install python extension with explicit pip call
* tamaas: patching compilation issues with recent compilers
* tamaas: added versions 2.7.0 and 2.7.1
This commit is contained in:
Lucas Frérot 2024-06-01 01:02:24 +02:00 committed by GitHub
parent bb7299c04a
commit 88b357c453
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 75 additions and 1 deletions

View File

@ -17,7 +17,9 @@ class Tamaas(SConsPackage):
maintainers("prs513rosewood")
version("master", branch="master")
version("2.6.0", sha256="e3a262e5b893aa1e23554b6bd6b41af68c841ef4ffd862bb8e50a1a17ac15af6")
version("2.7.1", sha256="d7de6db3f5532bb9c8ab7e8cca1cdb5c133050dd5720249dde07027b0d41641f")
version("2.7.0", sha256="bc5717c1ead621cb9c18a073fdafbe8778fd160ad23d80c98283445d79066579")
version("2.6.0", sha256="4aafa0f727f43afc6ae45705ae80cf113a6a95e728bdf536c22b3b39be87f153")
version(
"2.5.0.post1", sha256="28e52dc5b8a5f77588c73a6ef396c44c6a8e9d77e3e4929a4ab07232dc9bc565"
)
@ -46,6 +48,10 @@ class Tamaas(SConsPackage):
conflicts("%clang@:5")
conflicts("%intel")
# MPI type-traits issues (constexpr vs static const) in recent gcc
# fixed for tamaas versions > 2.6.0
patch("recent_compilers.patch", when="@:2.6.0%gcc@11:")
with when("+python"):
extends("python")
depends_on("python@3.7:", type=("build", "run"))
@ -53,6 +59,7 @@ class Tamaas(SConsPackage):
depends_on("py-scipy", when="+solvers", type="run")
depends_on("py-pybind11", type="build")
depends_on("py-wheel", type="build")
depends_on("py-pip", type="build")
def build_args(self, spec, prefix):
args = [
@ -77,3 +84,13 @@ def build_args(self, spec, prefix):
args += ["PYBIND11_ROOT={}".format(spec["py-pybind11"].prefix)]
return args
def install(self, spec, prefix):
"""Install the package."""
args = self.install_args(spec, prefix)
scons("install-lib", *args)
if spec.satisfies("+python"):
args = ["-m", "pip"] + std_pip_args + ["--prefix=" + prefix, "build-release/python"]
python(*args)

View File

@ -0,0 +1,57 @@
diff --git a/src/core/mpi_interface.cpp b/src/core/mpi_interface.cpp
index e7f9f72..f602fb1 100644
--- a/src/core/mpi_interface.cpp
+++ b/src/core/mpi_interface.cpp
@@ -36,6 +36,30 @@ comm& comm::world() {
static comm _world{MPI_COMM_WORLD};
return _world;
}
+
+// Define type traits for MPI data types
+#define TYPE(t, mpi_t) \
+ const MPI_Datatype type_trait<t>::value { mpi_t }
+TYPE(double, MPI_DOUBLE);
+TYPE(int, MPI_INT);
+TYPE(unsigned int, MPI_UNSIGNED);
+TYPE(long double, MPI_LONG_DOUBLE);
+TYPE(long, MPI_LONG);
+TYPE(unsigned long, MPI_UNSIGNED_LONG);
+TYPE(::thrust::complex<double>, MPI_CXX_DOUBLE_COMPLEX);
+TYPE(::thrust::complex<long double>, MPI_CXX_LONG_DOUBLE_COMPLEX);
+TYPE(bool, MPI_CXX_BOOL);
+#undef TYPE
+
+// Define type traits for MPI operations
+#define OPERATION(op, mpi_op) \
+ const MPI_Op operation_trait<operation::op>::value { mpi_op }
+OPERATION(plus, MPI_SUM);
+OPERATION(min, MPI_MIN);
+OPERATION(max, MPI_MAX);
+OPERATION(times, MPI_PROD);
+#undef OPERATION
+
} // namespace mpi_impl
#endif
diff --git a/src/core/mpi_interface.hh b/src/core/mpi_interface.hh
index b4cfc81..b53c826 100644
--- a/src/core/mpi_interface.hh
+++ b/src/core/mpi_interface.hh
@@ -149,7 +149,7 @@ struct type_trait;
#define TYPE(t, mpi_t) \
template <> \
struct type_trait<t> { \
- static constexpr MPI_Datatype value = mpi_t; \
+ static const MPI_Datatype value; \
}
TYPE(double, MPI_DOUBLE);
TYPE(int, MPI_INT);
@@ -168,7 +168,7 @@ struct operation_trait;
#define OPERATION(op, mpi_op) \
template <> \
struct operation_trait<operation::op> { \
- static constexpr MPI_Op value = mpi_op; \
+ static const MPI_Op value; \
}
OPERATION(plus, MPI_SUM);
OPERATION(min, MPI_MIN);