nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 74 lines 1.4 kB view raw
1{ 2 lib, 3 stdenv, 4 makeImpureTest, 5 fetchFromGitHub, 6 clr, 7 rocm-smi, 8 name, 9 offloadArches, 10}: 11 12let 13 # TODO: swap to another tiny test if this breaks; upstream is archived but fine for now 14 vectoradd = stdenv.mkDerivation { 15 pname = "rocm-hip-vectoradd"; 16 version = "2024-04-11"; 17 18 src = fetchFromGitHub { 19 owner = "ROCm"; 20 repo = "HIP-Examples"; 21 rev = "cdf9d101acd9a3fc89ee750f73c1f1958cbd5cc3"; 22 hash = "sha256-/I1KmOBFbEZIjA1vRE+2tPTtEKtOgazjCbnZtr+87E0="; 23 }; 24 25 nativeBuildInputs = [ 26 clr 27 ]; 28 29 installPhase = '' 30 runHook preInstall 31 32 mkdir -p $out/bin 33 amdclang++ -x hip -o $out/bin/vectoradd \ 34 ${lib.concatMapStringsSep " " (arch: "--offload-arch=${arch}") offloadArches} \ 35 vectorAdd/vectoradd_hip.cpp 36 37 runHook postInstall 38 ''; 39 40 meta = { 41 description = "vectorAdd HIP example for ROCm"; 42 homepage = "https://github.com/ROCm/HIP-Examples"; 43 license = lib.licenses.unfree; 44 platforms = lib.platforms.linux; 45 teams = [ lib.teams.rocm ]; 46 }; 47 }; 48 49in 50makeImpureTest { 51 inherit name; 52 testedPackage = "rocmPackages.clr"; 53 54 sandboxPaths = [ 55 "/sys" 56 "/dev/dri" 57 "/dev/kfd" 58 ]; 59 60 nativeBuildInputs = [ 61 vectoradd 62 rocm-smi 63 ]; 64 65 testScript = '' 66 rocm-smi 67 68 vectoradd 69 ''; 70 71 meta = { 72 teams = [ lib.teams.rocm ]; 73 }; 74}