Merge pull request #272093 from ConnorBaker/fix/nccl-tests-support-cuda-prev-11_4

cudaPackages.nccl-tests: support building with CUDA < 11.4 with cudatoolkit
This commit is contained in:
Connor Baker 2023-12-04 14:53:44 -05:00 committed by GitHub
commit 35f91964c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,19 +1,29 @@
{ backendStdenv
, config
, cuda_cccl
, cuda_cudart
, cuda_nvcc
, cudaVersion
, fetchFromGitHub
, gitUpdater
, lib
, mpi
, mpiSupport ? false
, nccl
, which
# NOTE: Though NCCL tests is called within the cudaPackages package set, we avoid passing in
# the names of dependencies from that package set directly to avoid evaluation errors
# in the case redistributable packages are not available.
{
config,
cudaPackages,
fetchFromGitHub,
gitUpdater,
lib,
mpi,
mpiSupport ? false,
which,
}:
backendStdenv.mkDerivation (finalAttrs: {
let
inherit (cudaPackages)
backendStdenv
cuda_cccl
cuda_cudart
cuda_nvcc
cudatoolkit
cudaVersion
nccl
;
in
backendStdenv.mkDerivation (
finalAttrs: {
pname = "nccl-tests";
version = "2.13.8";
@ -27,24 +37,28 @@ backendStdenv.mkDerivation (finalAttrs: {
strictDeps = true;
nativeBuildInputs = [
cuda_nvcc
which
];
nativeBuildInputs =
[which]
++ lib.optionals (lib.versionOlder cudaVersion "11.4") [cudatoolkit]
++ lib.optionals (lib.versionAtLeast cudaVersion "11.4") [cuda_nvcc];
buildInputs = [
buildInputs =
[nccl]
++ lib.optionals (lib.versionOlder cudaVersion "11.4") [cudatoolkit]
++ lib.optionals (lib.versionAtLeast cudaVersion "11.4") [
cuda_nvcc.dev # crt/host_config.h
cuda_cudart
nccl
] ++ lib.optionals (lib.versionAtLeast cudaVersion "12.0") [
]
++ lib.optionals (lib.versionAtLeast cudaVersion "12.0") [
cuda_cccl.dev # <nv/target>
] ++ lib.optional mpiSupport mpi;
]
++ lib.optionals mpiSupport [mpi];
makeFlags = [
"CUDA_HOME=${cuda_nvcc}"
"NCCL_HOME=${nccl}"
] ++ lib.optionals mpiSupport [
"MPI=1"
];
makeFlags =
["NCCL_HOME=${nccl}"]
++ lib.optionals (lib.versionOlder cudaVersion "11.4") ["CUDA_HOME=${cudatoolkit}"]
++ lib.optionals (lib.versionAtLeast cudaVersion "11.4") ["CUDA_HOME=${cuda_nvcc}"]
++ lib.optionals mpiSupport ["MPI=1"];
enableParallelBuilding = true;
@ -64,6 +78,7 @@ backendStdenv.mkDerivation (finalAttrs: {
platforms = platforms.linux;
license = licenses.bsd3;
broken = !config.cudaSupport || (mpiSupport && mpi == null);
maintainers = with maintainers; [ jmillerpdt ] ++ teams.cuda.members;
maintainers = with maintainers; [jmillerpdt] ++ teams.cuda.members;
};
})
}
)