CUDA ctypes library

Hey Numba team, I’ve been working on a ctypes based CUDA API for Python. I wouldn’t go so far as to say it’s finished but it has most of the CUDA API wrapped as well as some higher level Python wrappers to make it easier to use. I’m using it my self for some of the projects I am working on. I’m going to make the repo public at some point but wanted some input. The way the CUDA calls work is similar to how you do things. I made a giant dictionary of all the functions available in CUDA and have a driver class that populates itself from this dictionary. However, the dictionary isn’t linked to any specific driver version. I’m wondering if it would be worth the effort to create separate tables for each CUDA version or maybe a main table for 8.0 and a bunch of diff tables to edit the base dictionary so that you can pick the version of CUDA you want to load (or call cuDriverGetVersion and automate the process). Is this something worth doing or would it be better to just update the dictionary with whatever the current CUDA version supports? I think the main thing stopping me from doing this right now is I don’t know of an easy way to see the diffs in the API between versions so it would require going through each documentation version to find the diffs myself. I am mainly looking for validation to see if this is even worth it lol.

Chris

Hi @uchytilc,

Any thoughts on this @gmarkall @testhound ?

Thanks.

Hi @uchytilc and @stuartarchibald I don’t have much experience with this part of the code. But my hunch suggests that having a dictionary for each supported version makes sense. Practically I like the suggestion of a main table for 8.0 and diff tables to prevent duplication.

Thanks for the input! I think version control is going to be the biggest hurdle. There are also the enums, stucts, etc that also need to be associated with a CUDA version. I will probably release the repo before addressing this but it’s something I will be thinking about. Im also not totally sure how to deal with version control for the higher level Python API. I don’t think CUDA typically, if ever, has changed the purpose of a function but at the very least it has deprecated (and removed?) functions. Maybe keeping them all in a single file and not worrying about version control on that front would be fine.