Nim bindings for the CUDA libraries. The versions currently in use are
Most libraries have working bindings. Out of these:
/c2nim
)Ideally, once some improvements are available in c2nim, there should be no need to manually modify any files.
See a few examples under /examples
. The examples can be run with the command
nimble EXAMPLE_NAME CUDA_VERSION
, where EXAMPLE_NAME
is one of the examples and
CUDA_VERSION
is the version of cuda that you want it to run on - for
instance nimble fft 12.5
.
API documentation lives under /htmldocs
. Generate it by running nimble docs
.
c2nim supports name mangling, which could be useful to simplify a few names
(e.g. turn CUBLAS_STATUS_ARCH_MISMATCH
into ARCH_MISMATCH
, which can be
qualified as cublasStatus_t.ARCH_MISMATCH
in case of ambiguity).
Right now, no unnecessary mangling is performed, because the API surface is large and not always consistent, so it felt simpler to leave it as is. This may change in a future release.
In each cuda version's library there is a file called check.nim
.
In it are a few templates that turn CUDA errors
into Nim exceptions. They are all under the overloaded name check
, so that
one can do, for instance
check cudaMalloc(cast[ptr pointer](addr gpuRows), sizeof(rows))
(here cudaMalloc
is one of the many functions that fail by returning an
error code).