Skip to content

Commit

Permalink
Another promotional code fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalroz committed Sep 23, 2024
1 parent 5d64504 commit dbf0d57
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,18 @@ Don't you wish you were able to type in, say:
auto callback = [&foo] { std::cout << "Hello " << foo << " world!\n"; }
my_stream.enqueue.host_invokable(callback);
```
... and have that just work? Well, now it does!
... and have that just work? And don't you wish CUDA API invocations could be plain and straightforward one-liners? Like this sequence?
```cpp
auto compilation_output = my_program.compile();
auto module = cuda::module::create(context, compilation_output);
auto my_kernel = module.get_kernel(mangled_kernel_name);
auto gpu_side_buffer = cuda::memory::make_unique_span<float>(device, n);
cuda::memory::copy(gpu_side_buffer, host_side_buffer);
auto launch_config = cuda::launch_config_builder().overall_size(n).block_size(256).build();
cuda::launch(my_kernel, launch_config, gpu_side_buffer.data());
cuda::memory::copy(host_side_buffer, gpu_side_buffer);
```
Well, now all of the above is valid code! :-)
To be a little more thorough than just an anecdote, let's relate back to some of the design principles listed above:
Expand Down

0 comments on commit dbf0d57

Please sign in to comment.