2023-03-08 16:32:21 +00:00
|
|
|
{ lib, backendStdenv, fetchFromGitHub
|
2021-03-19 17:17:44 +00:00
|
|
|
, cmake, addOpenGLRunpath
|
|
|
|
, cudatoolkit
|
2022-04-15 01:41:22 +00:00
|
|
|
, cutensor
|
2021-03-19 17:17:44 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
rev = "5aab680905d853bce0dbad4c488e4f7e9f7b2302";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "NVIDIA";
|
|
|
|
repo = "CUDALibrarySamples";
|
|
|
|
inherit rev;
|
|
|
|
sha256 = "0gwgbkq05ygrfgg5hk07lmap7n7ampxv0ha1axrv8qb748ph81xs";
|
|
|
|
};
|
|
|
|
commonAttrs = {
|
|
|
|
version = lib.strings.substring 0 7 rev + "-" + lib.versions.majorMinor cudatoolkit.version;
|
|
|
|
nativeBuildInputs = [ cmake addOpenGLRunpath ];
|
|
|
|
buildInputs = [ cudatoolkit ];
|
|
|
|
postFixup = ''
|
|
|
|
for exe in $out/bin/*; do
|
|
|
|
addOpenGLRunpath $exe
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
meta = {
|
|
|
|
description = "examples of using libraries using CUDA";
|
|
|
|
longDescription = ''
|
|
|
|
CUDA Library Samples contains examples demonstrating the use of
|
|
|
|
features in the math and image processing libraries cuBLAS, cuTENSOR,
|
|
|
|
cuSPARSE, cuSOLVER, cuFFT, cuRAND, NPP and nvJPEG.
|
|
|
|
'';
|
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = with lib.maintainers; [ obsidian-systems-maintenance ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2023-03-08 16:32:21 +00:00
|
|
|
cublas = backendStdenv.mkDerivation (commonAttrs // {
|
2021-03-19 17:17:44 +00:00
|
|
|
pname = "cuda-library-samples-cublas";
|
|
|
|
|
|
|
|
src = "${src}/cuBLASLt";
|
|
|
|
});
|
|
|
|
|
2023-03-08 16:32:21 +00:00
|
|
|
cusolver = backendStdenv.mkDerivation (commonAttrs // {
|
2021-03-19 17:17:44 +00:00
|
|
|
pname = "cuda-library-samples-cusolver";
|
|
|
|
|
|
|
|
src = "${src}/cuSOLVER";
|
|
|
|
|
|
|
|
sourceRoot = "cuSOLVER/gesv";
|
|
|
|
});
|
|
|
|
|
2023-03-08 16:32:21 +00:00
|
|
|
cutensor = backendStdenv.mkDerivation (commonAttrs // {
|
2021-03-19 17:17:44 +00:00
|
|
|
pname = "cuda-library-samples-cutensor";
|
|
|
|
|
|
|
|
src = "${src}/cuTENSOR";
|
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
buildInputs = [ cutensor ];
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DCUTENSOR_EXAMPLE_BINARY_INSTALL_DIR=${builtins.placeholder "out"}/bin"
|
|
|
|
];
|
|
|
|
|
|
|
|
# CUTENSOR_ROOT is double escaped
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace CMakeLists.txt \
|
2022-04-15 01:41:22 +00:00
|
|
|
--replace "\''${CUTENSOR_ROOT}/include" "${cutensor.dev}/include"
|
2021-03-19 17:17:44 +00:00
|
|
|
'';
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
CUTENSOR_ROOT = cutensor;
|
2021-03-19 17:17:44 +00:00
|
|
|
});
|
|
|
|
}
|