Skip to content

Commit

Permalink
Fixes #301 : Can now assign launch configurations.
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalroz committed Mar 11, 2022
1 parent fbe11dd commit 3fc9c4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/by_runtime_api_module/execution_control.cu
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ int main(int argc, char **argv)
std::cout
<< "Launching kernel " << kernel_name
<< " with " << num_blocks << " blocks, using cuda::launch()\n" << std::flush;
{
// Copy and move construction and assignment of launch configurations
auto launch_config_2 = cuda::make_launch_config(2, 2, 2);
auto launch_config_3 = cuda::make_launch_config(3, 3, 3);
[[maybe_unused]] cuda::launch_configuration_t launch_config_4{launch_config};
launch_config_4 = launch_config_2;
launch_config_4 = std::move(launch_config_3);
[[maybe_unused]] cuda::launch_configuration_t launch_config_5{std::move(launch_config_2)};
}

cuda::launch(kernel_function, launch_config, bar);
cuda::device::current::get().synchronize();

Expand Down
4 changes: 4 additions & 0 deletions src/cuda/api/launch_configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ struct launch_configuration_t {
dynamic_shared_mem,
thread_block_cooperation)
{ }

// These can be made constexpr in C++14
launch_configuration_t& operator=(const launch_configuration_t& other) = default;
launch_configuration_t& operator=(launch_configuration_t&&) = default;
};

/**
Expand Down

0 comments on commit 3fc9c4c

Please sign in to comment.