Skip to content

Commit

Permalink
cuda_launch increase num blocks for small arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
burlen committed Aug 24, 2023
1 parent 4c9175b commit 8a9cb07
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hamr_cuda_launch.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ int partition_thread_blocks(size_t array_size,
{
unsigned long threads_per_block = warps_per_block * warp_size;

while ((threads_per_block > array_size) && (warps_per_block > 1))
{
--warps_per_block;
threads_per_block = warps_per_block * warp_size;
}

thread_grid.x = threads_per_block;
thread_grid.y = 1;
thread_grid.z = 1;
Expand Down

0 comments on commit 8a9cb07

Please sign in to comment.