From 94fa0de4fcdb6874c39724e359d2308c09cc14dd Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Sun, 2 Apr 2023 21:23:46 +0200 Subject: [PATCH] Add slurm 16.05.8.1 and hwloc 1.11.6 --- bsc/hwloc/1.11.6/default.nix | 70 ++++++++++++++++++ bsc/slurm/16.05.8.1/common-env-echo.patch | 13 ++++ bsc/slurm/16.05.8.1/default.nix | 87 +++++++++++++++++++++++ bsc/slurm/16.05.8.1/major.patch | 10 +++ bsc/slurm/16.05.8.1/mvwprintw.patch | 11 +++ bsc/slurm/16.05.8.1/pmi2.nix | 22 ++++++ bsc/slurm/16.05.8.1/pmix-configure.patch | 13 ++++ overlay.nix | 7 ++ 8 files changed, 233 insertions(+) create mode 100644 bsc/hwloc/1.11.6/default.nix create mode 100644 bsc/slurm/16.05.8.1/common-env-echo.patch create mode 100644 bsc/slurm/16.05.8.1/default.nix create mode 100644 bsc/slurm/16.05.8.1/major.patch create mode 100644 bsc/slurm/16.05.8.1/mvwprintw.patch create mode 100644 bsc/slurm/16.05.8.1/pmi2.nix create mode 100644 bsc/slurm/16.05.8.1/pmix-configure.patch diff --git a/bsc/hwloc/1.11.6/default.nix b/bsc/hwloc/1.11.6/default.nix new file mode 100644 index 0000000..1754fe5 --- /dev/null +++ b/bsc/hwloc/1.11.6/default.nix @@ -0,0 +1,70 @@ +{ stdenv, lib, fetchurl, pkgconfig, expat, ncurses +, pciutils, numactl }: + +with lib; + +stdenv.mkDerivation rec { + name = "hwloc-1.11.6"; + + src = fetchurl { + url = "http://www.open-mpi.org/software/hwloc/v1.11/downloads/${name}.tar.bz2"; + sha256 = "1yl7dm2qplwmnidd712zy12qfvxk28k8ccs694n42ybwdjwzg1bn"; + }; + + nativeBuildInputs = [ pkgconfig ]; + + # Filter out `null' inputs. This allows users to `.override' the + # derivation and set optional dependencies to `null'. + buildInputs = filter (x: x != null) + ([ expat ncurses ] + ++ (optionals stdenv.isLinux [ numactl ])); + + propagatedBuildInputs = + # Since `libpci' appears in `hwloc.pc', it must be propagated. + optional stdenv.isLinux pciutils; + + enableParallelBuilding = true; + + postInstall = + optionalString (stdenv.isLinux && numactl != null) + '' if [ -d "${numactl}/lib64" ] + then + numalibdir="${numactl}/lib64" + else + numalibdir="${numactl}/lib" + test -d "$numalibdir" + fi + + sed -i "$out/lib/libhwloc.la" \ + -e "s|-lnuma|-L$numalibdir -lnuma|g" + ''; + + # Checks disabled because they're impure (hardware dependent) and + # fail on some build machines. + doCheck = false; + + meta = { + description = "Portable abstraction of hierarchical architectures for high-performance computing"; + longDescription = '' + hwloc provides a portable abstraction (across OS, + versions, architectures, ...) of the hierarchical topology of + modern architectures, including NUMA memory nodes, sockets, + shared caches, cores and simultaneous multithreading. It also + gathers various attributes such as cache and memory + information. It primarily aims at helping high-performance + computing applications with gathering information about the + hardware so as to exploit it accordingly and efficiently. + + hwloc may display the topology in multiple convenient + formats. It also offers a powerful programming interface to + gather information about the hardware, bind processes, and much + more. + ''; + + # http://www.open-mpi.org/projects/hwloc/license.php + license = licenses.bsd3; + homepage = http://www.open-mpi.org/projects/hwloc/; + maintainers = [ ]; + platforms = platforms.all; + }; +} diff --git a/bsc/slurm/16.05.8.1/common-env-echo.patch b/bsc/slurm/16.05.8.1/common-env-echo.patch new file mode 100644 index 0000000..4236421 --- /dev/null +++ b/bsc/slurm/16.05.8.1/common-env-echo.patch @@ -0,0 +1,13 @@ +diff --git a/src/common/env.c b/src/common/env.c +index 987846d..73d3b3b 100644 +--- a/src/common/env.c ++++ b/src/common/env.c +@@ -1941,7 +1941,7 @@ char **env_array_user_default(const char *username, int timeout, int mode, + char **env = NULL; + char *starttoken = "XXXXSLURMSTARTPARSINGHEREXXXX"; + char *stoptoken = "XXXXSLURMSTOPPARSINGHEREXXXXX"; +- char cmdstr[256], *env_loc = NULL; ++ char cmdstr[MAXPATHLEN], *env_loc = NULL; + char *stepd_path = NULL; + int fd1, fd2, fildes[2], found, fval, len, rc, timeleft; + int buf_read, buf_rem, config_timeout; diff --git a/bsc/slurm/16.05.8.1/default.nix b/bsc/slurm/16.05.8.1/default.nix new file mode 100644 index 0000000..4d85ac0 --- /dev/null +++ b/bsc/slurm/16.05.8.1/default.nix @@ -0,0 +1,87 @@ +{ stdenv, lib, fetchFromGitHub, pkgconfig, libtool, curl +, python3, munge, perl, pam, zlib, shadow, coreutils +, ncurses, libmysqlclient, lua, hwloc, numactl +, readline, freeipmi, xorg, lz4, rdma-core, nixosTests +, pmix, enableX11 ? false +}: + +stdenv.mkDerivation rec { + pname = "slurm"; + version = "16.05.8.1"; + + # N.B. We use github release tags instead of https://www.schedmd.com/downloads.php + # because the latter does not keep older releases. + src = fetchFromGitHub { + owner = "SchedMD"; + repo = "slurm"; + # The release tags use - instead of . + rev = "${pname}-${builtins.replaceStrings ["."] ["-"] version}"; + sha256 = "1fkrbi4f22jb2pq19sv3j2yyvac4nh25fk8mzw6ic24swxp8wq9s"; + }; + + outputs = [ "out" "dev" ]; + + patches = [ + ./major.patch + ./mvwprintw.patch + # increase string length to allow for full + # path of 'echo' in nix store + #./common-env-echo.patch + # Required for configure to pick up the right dlopen path + #./pmix-configure.patch + ]; + + prePatch = '' + substituteInPlace src/common/env.c \ + --replace "/bin/echo" "${coreutils}/bin/echo" + ''; + + # nixos test fails to start slurmd with 'undefined symbol: slurm_job_preempt_mode' + # https://groups.google.com/forum/#!topic/slurm-devel/QHOajQ84_Es + # this doesn't fix tests completely at least makes slurmd to launch + hardeningDisable = [ "fortify" "bindnow" ]; + + nativeBuildInputs = [ pkgconfig libtool python3 ]; + buildInputs = [ + curl python3 munge perl pam zlib + libmysqlclient ncurses lz4 rdma-core + lua hwloc numactl readline freeipmi shadow.su + pmix + ]; + + configureFlags = [ + "CFLAGS=-fcommon" + "--with-freeipmi=${freeipmi}" + "--with-hwloc=${hwloc}" + "--with-lz4=${lz4.dev}" + "--with-munge=${munge}" + "--with-zlib=${zlib}" + "--with-ofed=${rdma-core}" + "--sysconfdir=/etc/slurm" + "--with-pmix=${pmix}" + "--disable-gtktest" + "--disable-x11" + ]; + + + preConfigure = '' + patchShebangs ./doc/html/shtml2html.py + patchShebangs ./doc/man/man2html.py + ''; + + postInstall = '' + rm -f $out/lib/*.la $out/lib/slurm/*.la + ''; + + enableParallelBuilding = true; + + passthru.tests.slurm = nixosTests.slurm; + + meta = with lib; { + homepage = "http://www.schedmd.com/"; + description = "Simple Linux Utility for Resource Management"; + platforms = platforms.linux; + license = licenses.gpl2; + maintainers = with maintainers; [ jagajaga markuskowa ]; + }; +} diff --git a/bsc/slurm/16.05.8.1/major.patch b/bsc/slurm/16.05.8.1/major.patch new file mode 100644 index 0000000..82300bc --- /dev/null +++ b/bsc/slurm/16.05.8.1/major.patch @@ -0,0 +1,10 @@ +--- a/src/plugins/task/cgroup/task_cgroup_devices.c 1970-01-01 01:00:01.000000000 +0100 ++++ b/src/plugins/task/cgroup/task_cgroup_devices.c 1970-01-01 01:00:01.000000000 +0100 +@@ -43,6 +43,7 @@ + #include + #include + #include ++#include + #include + #include + #include "src/common/xstring.h" diff --git a/bsc/slurm/16.05.8.1/mvwprintw.patch b/bsc/slurm/16.05.8.1/mvwprintw.patch new file mode 100644 index 0000000..cfa5e86 --- /dev/null +++ b/bsc/slurm/16.05.8.1/mvwprintw.patch @@ -0,0 +1,11 @@ +--- a/src/smap/partition_functions.c 2023-04-02 21:07:54.505816546 +0200 ++++ b/src/smap/partition_functions.c 2023-04-02 21:07:43.512816197 +0200 +@@ -588,7 +588,7 @@ + else + tmp_state = "unk"; + mvwprintw(text_win, main_ycord, main_xcord, +- tmp_state); ++ "%s", tmp_state); + main_xcord += 7; + + if (part_ptr->max_time == INFINITE) diff --git a/bsc/slurm/16.05.8.1/pmi2.nix b/bsc/slurm/16.05.8.1/pmi2.nix new file mode 100644 index 0000000..fa2fe64 --- /dev/null +++ b/bsc/slurm/16.05.8.1/pmi2.nix @@ -0,0 +1,22 @@ +{ + stdenv +, slurm +}: + +stdenv.mkDerivation rec { + name = "pmi2-${version}"; + + inherit (slurm) src version prePatch nativeBuildInputs buildInputs + configureFlags preConfigure; + + # Only build the pmi2 library + preBuild = ''cd contribs/pmi2''; + + # Include also the pmi.h header + postInstall = '' + mkdir -p $out/include + cp ../../slurm/pmi.h $out/include + ''; + + enableParallelBuilding = true; +} diff --git a/bsc/slurm/16.05.8.1/pmix-configure.patch b/bsc/slurm/16.05.8.1/pmix-configure.patch new file mode 100644 index 0000000..21c2197 --- /dev/null +++ b/bsc/slurm/16.05.8.1/pmix-configure.patch @@ -0,0 +1,13 @@ +diff --git a/configure b/configure +index 1cf53bc..ab68441 100755 +--- a/configure ++++ b/configure +@@ -21207,7 +21207,7 @@ rm -f conftest.err conftest.i conftest.$ac_ext + as_fn_error $? "error processing $x_ac_cv_pmix_libdir: PMIx v3.x was already found in one of the previous paths" "$LINENO" 5 + fi + _x_ac_pmix_v3_found="1" +- PMIX_V3_CPPFLAGS="-I$x_ac_cv_pmix_dir/include" ++ PMIX_V3_CPPFLAGS="-I$x_ac_cv_pmix_dir/include -DPMIXP_V3_LIBPATH=\\\"$x_ac_cv_pmix_libdir\\\"" + if test "$ac_with_rpath" = "yes"; then + PMIX_V3_LDFLAGS="-Wl,-rpath -Wl,$x_ac_cv_pmix_libdir -L$x_ac_cv_pmix_libdir" + else diff --git a/overlay.nix b/overlay.nix index 2ba4d06..d6f07fa 100644 --- a/overlay.nix +++ b/overlay.nix @@ -272,6 +272,13 @@ let slurm17-libpmi2 = callPackage ./bsc/slurm/pmi2.nix { pmix = bsc.pmix2; }; + + slurm-16-05-8-1 = callPackage ./bsc/slurm/16.05.8.1/default.nix { + hwloc = bsc.hwloc-1-11-6; + }; + + hwloc-1-11-6 = callPackage ./bsc/hwloc/1.11.6/default.nix {}; + # Use a slurm compatible with MN4 slurm = bsc.slurm17; # We need the unstable branch to get the fallocate problem fixed, as it is