Skip to content

Commit 793251b

Browse files
committed
General: Add CUDA 13 support
1 parent 5664a38 commit 793251b

3 files changed

Lines changed: 18 additions & 35 deletions

File tree

cmake/cuda/determine_thrust_paths.cmake

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@ function(stdgpu_determine_thrust_paths STDGPU_OUTPUT_THRUST_PATHS)
44

55
find_package(CUDAToolkit QUIET)
66

7-
set(${STDGPU_OUTPUT_THRUST_PATHS} "${CUDAToolkit_INCLUDE_DIRS}")
7+
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 13 AND CMAKE_VERSION VERSION_LESS 3.31.9)
8+
set(STDGPU_CUDATOOLKIT_INCLUDE_DIRS "${CUDAToolkit_INCLUDE_DIRS}")
9+
10+
foreach(dir IN LISTS CUDAToolkit_INCLUDE_DIRS)
11+
list(APPEND STDGPU_CUDATOOLKIT_INCLUDE_DIRS "${dir}/cccl")
12+
endforeach()
13+
14+
set(${STDGPU_OUTPUT_THRUST_PATHS} "${STDGPU_CUDATOOLKIT_INCLUDE_DIRS}")
15+
else()
16+
set(${STDGPU_OUTPUT_THRUST_PATHS} "${CUDAToolkit_INCLUDE_DIRS}")
17+
endif()
818

919
# Make output variable visible
1020
set(${STDGPU_OUTPUT_THRUST_PATHS} ${${STDGPU_OUTPUT_THRUST_PATHS}} PARENT_SCOPE)

src/stdgpu/cuda/impl/device.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ namespace stdgpu::cuda
5050
void
5151
print_device_information()
5252
{
53+
int device = 0;
54+
5355
cudaDeviceProp properties;
54-
if (cudaGetDeviceProperties(&properties, 0) != cudaSuccess)
56+
if (cudaGetDeviceProperties(&properties, device) != cudaSuccess)
5557
{
5658
printf("+---------------------------------------------------------+\n");
5759
printf("| Invalid CUDA Device |\n");
@@ -66,6 +68,9 @@ print_device_information()
6668
std::size_t total_memory = 0;
6769
STDGPU_CUDA_SAFE_CALL(cudaMemGetInfo(&free_memory, &total_memory));
6870

71+
int clock_rate = 0;
72+
cudaDeviceGetAttribute(&clock_rate, cudaDevAttrClockRate, device);
73+
6974
std::string gpu_name = properties.name;
7075
const int gpu_name_total_width = 57;
7176
int gpu_name_size = static_cast<int>(gpu_name.size());
@@ -77,7 +82,7 @@ print_device_information()
7782
printf("+---------------------------------------------------------+\n");
7883
printf("| Compute Capability : %1d.%1d |\n", properties.major, properties.minor);
7984
printf("| Clock rate : %-6.0f MHz |\n",
80-
static_cast<double>(detail::kilo_to_mega_hertz(static_cast<float>(properties.clockRate))));
85+
static_cast<double>(detail::kilo_to_mega_hertz(static_cast<float>(clock_rate))));
8186
printf("| Global Memory : %-6.3f GiB / %-6.3f GiB |\n",
8287
static_cast<double>(detail::byte_to_gibi_byte(static_cast<float>(free_memory))),
8388
static_cast<double>(detail::byte_to_gibi_byte(static_cast<float>(total_memory))));

src/stdgpu/iterator.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,38 +50,6 @@ using device_ptr = thrust::pointer<T, thrust::device_system_tag>;
5050
template <typename T>
5151
using host_ptr = thrust::pointer<T, thrust::host_system_tag>;
5252

53-
} // namespace stdgpu
54-
55-
//! @cond Doxygen_Suppress
56-
namespace std // NOLINT(cert-dcl58-cpp)
57-
{
58-
59-
template <typename T>
60-
struct iterator_traits<stdgpu::device_ptr<T>> // NOLINT(cert-dcl58-cpp)
61-
{
62-
using difference_type = typename std::iterator_traits<T*>::difference_type;
63-
using value_type = typename std::iterator_traits<T*>::value_type;
64-
using pointer = typename std::iterator_traits<T*>::pointer;
65-
using reference = typename std::iterator_traits<T*>::reference;
66-
using iterator_category = typename stdgpu::device_ptr<T>::iterator_category;
67-
};
68-
69-
template <typename T>
70-
struct iterator_traits<stdgpu::host_ptr<T>> // NOLINT(cert-dcl58-cpp)
71-
{
72-
using difference_type = typename std::iterator_traits<T*>::difference_type;
73-
using value_type = typename std::iterator_traits<T*>::value_type;
74-
using pointer = typename std::iterator_traits<T*>::pointer;
75-
using reference = typename std::iterator_traits<T*>::reference;
76-
using iterator_category = typename stdgpu::host_ptr<T>::iterator_category;
77-
};
78-
79-
} // namespace std
80-
//! @endcond
81-
82-
namespace stdgpu
83-
{
84-
8553
/**
8654
* \ingroup iterator
8755
* \brief Constructs a device_ptr object

0 commit comments

Comments
 (0)