From c33bbdb77dacd7a89b3f7a67bb68939175f3f5fd Mon Sep 17 00:00:00 2001 From: arezaii Date: Wed, 15 Jan 2025 22:39:23 -0700 Subject: [PATCH] add Arkouda server and client packages (#48054) Adds packages for the Arkouda server (`arkouda`) and Arkouda python client (`py-arkouda`). Arkouda server and client are divided into separate packages to allow for them to be installed independently of one another. Future work remains to add a `+dev` variant to `py-arkouda`, but that will require additional supporting packages made available through spack (e.g. for `py-pytest-env` --- .../arkouda/makefile-fpic-2024.06.21.patch | 13 +++ .../arkouda/makefile-fpic-2024.10.02.patch | 23 ++++ .../repos/builtin/packages/arkouda/package.py | 109 ++++++++++++++++++ .../builtin/packages/py-arkouda/package.py | 55 +++++++++ 4 files changed, 200 insertions(+) create mode 100644 var/spack/repos/builtin/packages/arkouda/makefile-fpic-2024.06.21.patch create mode 100644 var/spack/repos/builtin/packages/arkouda/makefile-fpic-2024.10.02.patch create mode 100644 var/spack/repos/builtin/packages/arkouda/package.py create mode 100644 var/spack/repos/builtin/packages/py-arkouda/package.py diff --git a/var/spack/repos/builtin/packages/arkouda/makefile-fpic-2024.06.21.patch b/var/spack/repos/builtin/packages/arkouda/makefile-fpic-2024.06.21.patch new file mode 100644 index 00000000000..ef88b1209fd --- /dev/null +++ b/var/spack/repos/builtin/packages/arkouda/makefile-fpic-2024.06.21.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index e607bb3cb..a4752dff6 100644 +--- a/Makefile ++++ b/Makefile +@@ -203,7 +203,7 @@ endif + + .PHONY: compile-arrow-cpp + compile-arrow-cpp: +- $(CHPL_CXX) -O3 -std=c++17 -c $(ARROW_CPP) -o $(ARROW_O) $(INCLUDE_FLAGS) $(ARROW_SANITIZE) ++ $(CHPL_CXX) -fPIC -O3 -std=c++17 -c $(ARROW_CPP) -o $(ARROW_O) $(INCLUDE_FLAGS) $(ARROW_SANITIZE) + + $(ARROW_O): $(ARROW_CPP) $(ARROW_H) + make compile-arrow-cpp diff --git a/var/spack/repos/builtin/packages/arkouda/makefile-fpic-2024.10.02.patch b/var/spack/repos/builtin/packages/arkouda/makefile-fpic-2024.10.02.patch new file mode 100644 index 00000000000..48beb345b56 --- /dev/null +++ b/var/spack/repos/builtin/packages/arkouda/makefile-fpic-2024.10.02.patch @@ -0,0 +1,23 @@ +diff --git a/Makefile b/Makefile +index 13a9c4be1..099896ec9 100644 +--- a/Makefile ++++ b/Makefile +@@ -236,15 +236,15 @@ compile-arrow-cpp: + + .PHONY: compile-arrow-write + compile-arrow-write: +- $(CHPL_CXX) -O3 -std=c++17 -c $(ARROW_WRITE_CPP) -o $(ARROW_WRITE_O) $(INCLUDE_FLAGS) $(ARROW_SANITIZE) ++ $(CHPL_CXX) -O3 -std=c++17 -fPIC -c $(ARROW_WRITE_CPP) -o $(ARROW_WRITE_O) $(INCLUDE_FLAGS) $(ARROW_SANITIZE) + + .PHONY: compile-arrow-read + compile-arrow-read: +- $(CHPL_CXX) -O3 -std=c++17 -c $(ARROW_READ_CPP) -o $(ARROW_READ_O) $(INCLUDE_FLAGS) $(ARROW_SANITIZE) ++ $(CHPL_CXX) -O3 -std=c++17 -fPIC -c $(ARROW_READ_CPP) -o $(ARROW_READ_O) $(INCLUDE_FLAGS) $(ARROW_SANITIZE) + + .PHONY: compile-arrow-util + compile-arrow-util: +- $(CHPL_CXX) -O3 -std=c++17 -c $(ARROW_UTIL_CPP) -o $(ARROW_UTIL_O) $(INCLUDE_FLAGS) $(ARROW_SANITIZE) ++ $(CHPL_CXX) -O3 -std=c++17 -fPIC -c $(ARROW_UTIL_CPP) -o $(ARROW_UTIL_O) $(INCLUDE_FLAGS) $(ARROW_SANITIZE) + + $(ARROW_UTIL_O): $(ARROW_UTIL_CPP) $(ARROW_UTIL_H) + make compile-arrow-util diff --git a/var/spack/repos/builtin/packages/arkouda/package.py b/var/spack/repos/builtin/packages/arkouda/package.py new file mode 100644 index 00000000000..6c61dba10fb --- /dev/null +++ b/var/spack/repos/builtin/packages/arkouda/package.py @@ -0,0 +1,109 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +import llnl.util.tty as tty + +from spack.package import * +from spack.util.environment import set_env + + +class Arkouda(MakefilePackage): + """Arkouda is a NumPy-like library for distributed data with a focus on + large-scale data science applications.""" + + homepage = "https://github.com/Bears-R-Us/arkouda" + + # Arkouda does not have a current PyPI package, so we use the GitHub tarball + url = "https://github.com/Bears-R-Us/arkouda/archive/refs/tags/v2024.10.02.tar.gz" + git = "https://github.com/Bears-R-Us/arkouda.git" + + # See https://spdx.org/licenses/ for a list. + license("MIT") + + # A list of GitHub accounts to notify when the package is updated. + # TODO: add arkouda devs github account + maintainers("arezaii") + + version("master", branch="master") + + version( + "2024.10.02", sha256="00671a89a08be57ff90a94052f69bfc6fe793f7b50cf9195dd7ee794d6d13f23" + ) + version( + "2024.06.21", sha256="ab7f753befb3a0b8e27a3d28f3c83332d2c6ae49678877a7456f0fcfe42df51c" + ) + + variant( + "distributed", + default=False, + description="Build Arkouda for multi-locale execution on a cluster or supercomputer", + ) + + depends_on("chapel@2.1: +hdf5 +zmq", type=("build", "link", "run", "test")) + depends_on("cmake@3.13.4:", type="build") + depends_on("python@3.9:", type=("build", "link", "run", "test")) + depends_on("libzmq@4.2.5:", type=("build", "link", "run", "test")) + depends_on("hdf5+hl~mpi", type=("build", "link", "run", "test")) + depends_on("libiconv", type=("build", "link", "run", "test")) + depends_on("libidn2", type=("build", "link", "run", "test")) + depends_on( + "arrow +parquet +snappy +zlib +brotli +bz2 +lz4 +zstd", + type=("build", "link", "run", "test"), + ) + + requires("^chapel comm=none", when="~distributed") + requires("^chapel +python-bindings", when="@2024.10.02:") + requires( + "^chapel comm=gasnet", + "^chapel comm=ugni", + "^chapel comm=ofi", + policy="one_of", + when="+distributed", + ) + + # Some systems need explicit -fPIC flag when building the Arrow functions + patch("makefile-fpic-2024.06.21.patch", when="@2024.06.21") + patch("makefile-fpic-2024.10.02.patch", when="@2024.10.02:") + + sanity_check_is_file = [join_path("bin", "arkouda_server")] + + def check(self): + # skip b/c we need the python client + pass + + # override the default edit method to apply the patch + def edit(self, spec, prefix): + self.update_makefile_paths(spec, prefix) + + def update_makefile_paths(self, spec, prefix): + # add to the Makefile.paths file for all of the dependencies installed by spack + # in the form $(eval $(call add-path,)) + with open("Makefile.paths", "w") as f: + f.write("$(eval $(call add-path,{0}))\n".format(spec["hdf5"].prefix)) + f.write("$(eval $(call add-path,{0}))\n".format(spec["libzmq"].prefix)) + f.write("$(eval $(call add-path,{0}))\n".format(spec["arrow"].prefix)) + f.write("$(eval $(call add-path,{0}))\n".format(spec["libiconv"].prefix)) + f.write("$(eval $(call add-path,{0}))\n".format(spec["libidn2"].prefix)) + + def build(self, spec, prefix): + # Detect distributed builds and skip the dependency checks built into + # the Arkouda Makefile. These checks will try to spawn multiple jobs which may + # cause the build to fail in situations where the user is constrained + # to a limited number of simultaneous jobs. + if spec.satisfies("+distributed"): + with set_env(ARKOUDA_SKIP_CHECK_DEPS="1"): + tty.warn("Distributed build detected. Skipping dependency checks") + make() + else: + make() + + # Arkouda does not have an install target in its Makefile + def install(self, spec, prefix): + mkdir(prefix.bin) + install("arkouda_server", prefix.bin) + # Arkouda can have two executables depending on if Chapel is compiled in + # single-locale or multi-locale mode + if spec.satisfies("+distributed"): + install("arkouda_server_real", prefix.bin) diff --git a/var/spack/repos/builtin/packages/py-arkouda/package.py b/var/spack/repos/builtin/packages/py-arkouda/package.py new file mode 100644 index 00000000000..f56cc74d75f --- /dev/null +++ b/var/spack/repos/builtin/packages/py-arkouda/package.py @@ -0,0 +1,55 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT)s + +from spack.package import * + + +class PyArkouda(PythonPackage): + """This is the python client for Arkouda.""" + + homepage = "https://github.com/Bears-R-Us/arkouda" + + # Updating the arkouda PyPI package is future work + url = "https://github.com/Bears-R-Us/arkouda/archive/refs/tags/v2024.10.02.tar.gz" + git = "https://github.com/Bears-R-Us/arkouda.git" + + # See https://spdx.org/licenses/ for a list. + license("MIT") + + test_requires_compiler = True + + # A list of GitHub accounts to notify when the package is updated. + # TODO: add arkouda devs github account + maintainers("arezaii") + + version("master", branch="master") + + version( + "2024.10.02", sha256="00671a89a08be57ff90a94052f69bfc6fe793f7b50cf9195dd7ee794d6d13f23" + ) + version( + "2024.06.21", sha256="ab7f753befb3a0b8e27a3d28f3c83332d2c6ae49678877a7456f0fcfe42df51c" + ) + + variant("dev", default=False, description="Include arkouda developer extras") + + depends_on("python@3.8:", type=("build", "run"), when="@:2024.06.21") + depends_on("python@3.9:3.12.3", type=("build", "run"), when="@2024.10.02:") + depends_on("py-setuptools", type="build") + depends_on("py-numpy@1.24.1:1.99", type=("build", "run")) + depends_on("py-pandas@1.4.0:", type=("build", "run")) + conflicts("^py-pandas@2.2.0", msg="arkouda client not compatible with pandas 2.2.0") + + depends_on("py-pyarrow", type=("build", "run")) + depends_on("py-pyzmq@20:", type=("build", "run")) + depends_on("py-scipy@:1.13.1", type=("build", "run"), when="@2024.06.21:") + depends_on("py-tables@3.7.0: +lzo +bzip2", type=("build", "run"), when="@:2024.06.21") + depends_on("py-tables@3.8.0: +lzo +bzip2", type=("build", "run"), when="@2024.10.02:") + depends_on("py-h5py@3.7.0:", type=("build", "run")) + depends_on("py-matplotlib@3.3.2:", type=("build", "run")) + depends_on("py-versioneer", type=("build")) + depends_on("py-pyfiglet", type=("build", "run")) + depends_on("py-typeguard@2.10:2.12", type=("build", "run")) + depends_on("py-tabulate", type=("build", "run")) + depends_on("py-pytest@6.0:", type=("build", "run"), when="@2024.10.02")