Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
This pr adds two new modules to the library: nvrtc and cuda.
cuda is better known the cuda driver api, which is very similar to the cuda runtime api but a bit lower level.
nvrtc is a module that enables the use of runtime compilation of cuda code.
An example of runtime compilation is also added. #19
Why
Currently, there is no good way to run cuda kernels from Nim. Here are some known options:
Use a cuda compiler to compile the entire project
__no_inline__
), requiring manual editing of the installed cuda headers.Transpile nim code to ptx
This pr enables a native, easy solution. Checkout the example (355290f) for all that is required to run a cuda kernel. Much of it is boilerplate that could be minimized by a higher-level library.
The cuda driver api was added mostly due to the fact that nvrtc requires that you use it instead of the cuda runtime api, but it should've been added long ago, imo.