Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nomad: add optional nvml support #108341

Merged
merged 1 commit into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkgs/applications/networking/cluster/nomad/0.11.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{ callPackage, buildGoPackage }:
{ callPackage
, buildGoPackage
, nvidia_x11
, nvidiaGpuSupport
}:

callPackage ./generic.nix {
inherit buildGoPackage;
inherit buildGoPackage nvidia_x11 nvidiaGpuSupport;
version = "0.11.8";
sha256 = "1dhh07bifr02jh2lls8fv1d9ra67ymgh8qxqvpvm0cd0qdd469z1";
}
8 changes: 6 additions & 2 deletions pkgs/applications/networking/cluster/nomad/0.12.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{ callPackage, buildGoPackage }:
{ callPackage
, buildGoPackage
, nvidia_x11
, nvidiaGpuSupport
}:

callPackage ./generic.nix {
inherit buildGoPackage;
inherit buildGoPackage nvidia_x11 nvidiaGpuSupport;
version = "0.12.9";
sha256 = "1a0ig6pb0z3qp7zk4jgz3h241bifmjlyqsfikyy3sxdnzj7yha27";
}
8 changes: 6 additions & 2 deletions pkgs/applications/networking/cluster/nomad/1.0.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{ callPackage, buildGoPackage }:
{ callPackage
, buildGoPackage
, nvidia_x11
, nvidiaGpuSupport
}:

callPackage ./generic.nix {
inherit buildGoPackage;
inherit buildGoPackage nvidia_x11 nvidiaGpuSupport;
version = "1.0.1";
sha256 = "07k81csyxhgc7bgn297zlqyvc55qb5fmiavi7dk81rdpg5m2zjvv";
}
46 changes: 32 additions & 14 deletions pkgs/applications/networking/cluster/nomad/generic.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{ stdenv, buildGoPackage, fetchFromGitHub, version, sha256 }:
{ lib
, buildGoPackage
, fetchFromGitHub
, version
, sha256
, nvidiaGpuSupport
, patchelf
, nvidia_x11
}:

buildGoPackage rec {
pname = "nomad";
Expand All @@ -14,23 +22,33 @@ buildGoPackage rec {
inherit rev sha256;
};

nativeBuildInputs = lib.optionals nvidiaGpuSupport [
patchelf
];

# ui:
# Nomad release commits include the compiled version of the UI, but the file
# is only included if we build with the ui tag.
# nonvidia:
# We disable Nvidia GPU scheduling on Linux, as it doesn't work there:
# Ref: https://github.com/hashicorp/nomad/issues/5535
preBuild = let
tags = ["ui"]
++ stdenv.lib.optional stdenv.isLinux "nonvidia";
tagsString = stdenv.lib.concatStringsSep " " tags;
in ''
export buildFlagsArray=(
-tags="${tagsString}"
)
'';
preBuild =
let
tags = [ "ui" ] ++ lib.optional (!nvidiaGpuSupport) "nonvidia";
tagsString = lib.concatStringsSep " " tags;
in
''
export buildFlagsArray=(
-tags="${tagsString}"
)
'';

# The dependency on NVML isn't explicit. We have to make it so otherwise the
# binary will not know where to look for the relevant symbols.
postFixup = lib.optionalString nvidiaGpuSupport ''
for bin in $out/bin/*; do
patchelf --add-needed "${nvidia_x11}/lib/libnvidia-ml.so" "$bin"
done
'';

meta = with stdenv.lib; {
meta = with lib; {
homepage = "https://www.nomadproject.io/";
description = "A Distributed, Highly Available, Datacenter-Aware Scheduler";
platforms = platforms.unix;
Expand Down
6 changes: 6 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6129,12 +6129,18 @@ in
# with different versions we pin Go for all versions.
nomad_0_11 = callPackage ../applications/networking/cluster/nomad/0.11.nix {
buildGoPackage = buildGo114Package;
inherit (linuxPackages) nvidia_x11;
nvidiaGpuSupport = config.cudaSupport or (!stdenv.isLinux);
};
nomad_0_12 = callPackage ../applications/networking/cluster/nomad/0.12.nix {
buildGoPackage = buildGo114Package;
inherit (linuxPackages) nvidia_x11;
nvidiaGpuSupport = config.cudaSupport or (!stdenv.isLinux);
};
nomad_1_0 = callPackage ../applications/networking/cluster/nomad/1.0.nix {
buildGoPackage = buildGo115Package;
inherit (linuxPackages) nvidia_x11;
nvidiaGpuSupport = config.cudaSupport or (!stdenv.isLinux);
};

notable = callPackage ../applications/misc/notable { };
Expand Down