Skip to content

Commit

Permalink
use cudaDeviceGetAttribute to get sm count (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasyadav18 authored Jul 19, 2024
1 parent 26042fe commit b7cd96d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/cuco/detail/utility/cuda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ constexpr auto max_occupancy_grid_size(int32_t block_size,
{
int32_t device = 0;
CUCO_CUDA_TRY(cudaGetDevice(&device));
cudaDeviceProp device_props;
CUCO_CUDA_TRY(cudaGetDeviceProperties(&device_props, device));
int32_t num_multiprocessors = device_props.multiProcessorCount;

int32_t num_multiprocessors = -1;
CUCO_CUDA_TRY(
cudaDeviceGetAttribute(&num_multiprocessors, cudaDevAttrMultiProcessorCount, device));

int32_t max_active_blocks_per_multiprocessor;
CUCO_CUDA_TRY(cudaOccupancyMaxActiveBlocksPerMultiprocessor(
&max_active_blocks_per_multiprocessor, kernel, block_size, dynamic_shm_size));
Expand Down

0 comments on commit b7cd96d

Please sign in to comment.