This year I read through Cuda by Example, and decided that I wanted to try 
getting all of the examples working with Nim.

I started working on a library named Hippo to add templates and macros to 
enable programming CUDA C or HIP in Nim. I got the basics working with multiple 
targets including Cuda / Nvidia, Hip -> rocm, HIP -> cuda, and CPU only with 
HIP-CPU (handy for debugging). <https://github.com/monofuel/hippo>

I recently got a Nim PR merged adding backends for nvcc and hipcc, now 
available in Nim >= 2.1.9. both CUDA C and HIP require using the C++ backend 
for Nim.

It still needs a lot more work, but I'm amazed that I've made at least this 
much progress. Here's an example of a julia set generator using Hippo: 
<https://github.com/monofuel/hippo/blob/master/tests/hip/julia.nim>

my workflow has been to do the exercises from the book in CUDA C, then port 
them to HIP (usually as easy as just running hipify) and then write it with Nim 
+ hippo. There is room for improvement to make the library more nim-y, but 
things are at least working.

Reply via email to