apptainer: add a cuda test

(cherry picked from commit 0c4fe1f452)
This commit is contained in:
Someone Serge 2024-01-06 22:50:52 +00:00
parent c76883f955
commit 231aca2b97
No known key found for this signature in database
GPG Key ID: 7B0E3B1390D61DA4

View File

@ -33,6 +33,7 @@ in
, which
# Build inputs
, bash
, callPackage
, conmon
, coreutils
, cryptsetup
@ -271,5 +272,38 @@ in
singularity = finalAttrs.finalPackage;
};
};
gpuChecks = lib.optionalAttrs (projectName == "apptainer") {
# Should be in tests, but Ofborg would skip image-hello-cowsay because
# saxpy is unfree.
image-saxpy = callPackage
({ singularity-tools, cudaPackages }:
singularity-tools.buildImage {
name = "saxpy";
contents = [ cudaPackages.saxpy ];
memSize = 2048;
diskSize = 2048;
singularity = finalAttrs.finalPackage;
})
{ };
saxpy =
callPackage
({ runCommand, writeShellScriptBin }:
let
unwrapped = writeShellScriptBin "apptainer-cuda-saxpy"
''
${lib.getExe finalAttrs.finalPackage} exec --nv $@ ${finalAttrs.passthru.gpuChecks.image-saxpy} saxpy
'';
in
runCommand "run-apptainer-cuda-saxpy"
{
requiredSystemFeatures = [ "cuda" ];
nativeBuildInputs = [ unwrapped ];
passthru = { inherit unwrapped; };
}
''
apptainer-cuda-saxpy
'')
{ };
};
};
})