Skip to content

Commit

Permalink
Now using the launch configuration builder also in vectorAddMMAP.
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalroz committed Apr 17, 2023
1 parent 5f6cc27 commit fdd9f4e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/modified_cuda_samples/vectorAddMMAP/vectorAddMMAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,14 @@ int main()
cuda::memory::copy(d_B_ptr, h_B.get(), size_in_bytes);

// Launch the Vector Add CUDA Kernel
int threads_per_block = 256;
int blocks_per_grid = div_rounding_up(num_elements, threads_per_block);
auto launch_config = cuda::make_launch_config(blocks_per_grid, threads_per_block);

std::cout << "CUDA kernel launch with " << blocks_per_grid << " blocks of " << threads_per_block << " threads" << std::endl;
auto launch_config = cuda::launch_config_builder()
.block_size(256)
.overall_size(num_elements)
.build();

std::cout
<< "CUDA kernel launch with " << launch_config.dimensions.grid.volume()
<< " blocks of " << launch_config.dimensions.grid.volume() << " threads" << std::endl;

cuda::launch(kernel, launch_config,
d_A_ptr, d_B_ptr, d_C_ptr, num_elements
Expand Down

0 comments on commit fdd9f4e

Please sign in to comment.