The cudainfo program is executed inside the build sandbox so we can see if it works properly. It uses the autoAddDriverRunpath hook to inject in the runpath the location of the library directory for CUDA libraries.
34 lines
630 B
Nix
34 lines
630 B
Nix
{
|
|
stdenv
|
|
, cudatoolkit
|
|
, cudaPackages
|
|
, autoAddDriverRunpath
|
|
, strace
|
|
}:
|
|
|
|
stdenv.mkDerivation {
|
|
name = "cudainfo";
|
|
src = ./.;
|
|
requiredSystemFeatures = [ "cuda" ];
|
|
buildInputs = [
|
|
cudatoolkit # Required for nvcc
|
|
cudaPackages.cuda_cudart.static # Required for -lcudart_static
|
|
autoAddDriverRunpath
|
|
strace
|
|
];
|
|
doInstallCheck = true;
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp -a cudainfo $out/bin
|
|
'';
|
|
installCheckPhase = ''
|
|
if ! $out/bin/cudainfo; then
|
|
set -x
|
|
ldd $out/bin/cudainfo
|
|
readelf -d $out/bin/cudainfo
|
|
strace -f $out/bin/cudainfo
|
|
set +x
|
|
fi
|
|
'';
|
|
}
|