forked from rarias/jungle
Add cudainfo program to test CUDA in sandbox
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.
This commit is contained in:
33
pkgs/cudainfo/default.nix
Normal file
33
pkgs/cudainfo/default.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
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
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user