Skip to content

Commit

Permalink
downgrade CUDA toolkit
Browse files Browse the repository at this point in the history
* make _VSTD workaround
  • Loading branch information
jacobtrombetta committed Sep 26, 2024
1 parent 135519f commit d63d5aa
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</a>

<a href="https://developer.nvidia.com/cuda-downloads">
<img alt="CUDA" src="https://img.shields.io/badge/CUDA-12.6-green?style=flat&logo=nvidia">
<img alt="CUDA" src="https://img.shields.io/badge/CUDA-12.4.1-green?style=flat&logo=nvidia">
</a>
</a>

Expand Down Expand Up @@ -182,7 +182,7 @@ See the [example](./example) folder for some examples.
Prerequisites:
* `x86_64` Linux instance.
* Nix with flake support (check out [The Determinate Nix Installer](https://github.com/DeterminateSystems/nix-installer))
* Nvidia GPU capable of running CUDA 12.6 code.
* Nvidia GPU capable of running CUDA 12.4.1 code.

From your terminal, run the following command in the root of the source directory to set
up a build environment.
Expand Down
5 changes: 2 additions & 3 deletions nix/cuda.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ with pkgs;
pkgs.stdenvNoCC.mkDerivation {
name = "cudatoolkit";
src = fetchurl {
url = "https://developer.download.nvidia.com/compute/cuda/12.6.0/local_installers/cuda_12.6.0_560.28.03_linux.run";
hash = "sha256-MasEOU5psU3YZW4rRMKHfbGg6Jjf+KdUakxihDgQG5Q=";

url = "https://developer.download.nvidia.com/compute/cuda/12.4.1/local_installers/cuda_12.4.1_550.54.15_linux.run";
sha256 = "367d2299b3a4588ab487a6d27276ca5d9ead6e394904f18bccb9e12433b9c4fb";
};
patches = [
# patch host_defines.h to work with libc++
Expand Down
20 changes: 20 additions & 0 deletions sxt/algorithm/block/runlength_count.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@
*/
#pragma once

/*
* This is a workaround to define _VSTD before including cub/cub.cuh.
* It should be removed when we can upgrade to a newer version of CUDA.
*
* We need to define _VSTD in order to use the clang version defined in
* clang.nix and the CUDA toolkit version defined in cuda.nix.
*
* _VSTD was deprecated and removed from the LLVM truck.
* NVIDIA: https://github.com/NVIDIA/cccl/pull/1331
* LLVM: https://github.com/llvm/llvm-project/commit/683bc94e1637bd9bacc978f5dc3c79cfc8ff94b9
*
* We cannot currently use any CUDA toolkit above 12.4.1 because the Kubernetes
* cluster currently cannot install a driver above 550.
*
* See CUDA toolkit and driver support: https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
*/
#include <__config>
#define _VSTD std::_LIBCPP_ABI_NAMESPACE
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

#include "cub/cub.cuh"
#include "sxt/base/macro/cuda_callable.h"

Expand Down
20 changes: 20 additions & 0 deletions sxt/multiexp/base/scalar_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@

#include <vector>

/*
* This is a workaround to define _VSTD before including cub/cub.cuh.
* It should be removed when we can upgrade to a newer version of CUDA.
*
* We need to define _VSTD in order to use the clang version defined in
* clang.nix and the CUDA toolkit version defined in cuda.nix.
*
* _VSTD was deprecated and removed from the LLVM truck.
* NVIDIA: https://github.com/NVIDIA/cccl/pull/1331
* LLVM: https://github.com/llvm/llvm-project/commit/683bc94e1637bd9bacc978f5dc3c79cfc8ff94b9
*
* We cannot currently use any CUDA toolkit above 12.4.1 because the Kubernetes
* cluster currently cannot install a driver above 550.
*
* See CUDA toolkit and driver support: https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
*/
#include <__config>
#define _VSTD std::_LIBCPP_ABI_NAMESPACE
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

#include "cub/cub.cuh"
#include "sxt/base/container/span_utility.h"
#include "sxt/base/device/memory_utility.h"
Expand Down
20 changes: 20 additions & 0 deletions sxt/multiexp/bucket_method2/multiproduct_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,26 @@
*/
#include "sxt/multiexp/bucket_method2/multiproduct_table.h"

/*
* This is a workaround to define _VSTD before including cub/cub.cuh.
* It should be removed when we can upgrade to a newer version of CUDA.
*
* We need to define _VSTD in order to use the clang version defined in
* clang.nix and the CUDA toolkit version defined in cuda.nix.
*
* _VSTD was deprecated and removed from the LLVM truck.
* NVIDIA: https://github.com/NVIDIA/cccl/pull/1331
* LLVM: https://github.com/llvm/llvm-project/commit/683bc94e1637bd9bacc978f5dc3c79cfc8ff94b9
*
* We cannot currently use any CUDA toolkit above 12.4.1 because the Kubernetes
* cluster currently cannot install a driver above 550.
*
* See CUDA toolkit and driver support: https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
*/
#include <__config>
#define _VSTD std::_LIBCPP_ABI_NAMESPACE
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

#include "cub/cub.cuh"
#include "sxt/algorithm/iteration/for_each.h"
#include "sxt/base/device/memory_utility.h"
Expand Down
20 changes: 20 additions & 0 deletions sxt/multiexp/bucket_method2/multiproduct_table_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@

#include <utility>

/*
* This is a workaround to define _VSTD before including cub/cub.cuh.
* It should be removed when we can upgrade to a newer version of CUDA.
*
* We need to define _VSTD in order to use the clang version defined in
* clang.nix and the CUDA toolkit version defined in cuda.nix.
*
* _VSTD was deprecated and removed from the LLVM truck.
* NVIDIA: https://github.com/NVIDIA/cccl/pull/1331
* LLVM: https://github.com/llvm/llvm-project/commit/683bc94e1637bd9bacc978f5dc3c79cfc8ff94b9
*
* We cannot currently use any CUDA toolkit above 12.4.1 because the Kubernetes
* cluster currently cannot install a driver above 550.
*
* See CUDA toolkit and driver support: https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
*/
#include <__config>
#define _VSTD std::_LIBCPP_ABI_NAMESPACE
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

#include "cub/cub.cuh"
#include "sxt/algorithm/block/runlength_count.h"
#include "sxt/base/device/stream.h"
Expand Down

0 comments on commit d63d5aa

Please sign in to comment.