CUDA support requires two main bits the above snapcraft.yaml doesn’t have
- You need to map the host driver into the snap, the gnome-extensions can handle this bit (even if it’s a CLI app that doesn’t spawn a GUI window at all).
- You need to ship (at a minimum) cudart.so yourself in your snap, but there might be some extras to consider.
So it’s important then to understand the CUDA EULA, which says which bits you can and can’t distribute, luckily cudart.so is on the distributable list!
To satisfy 1), just add
extensions: [gnome-3-34] under the app section, e.g
To satisfy 2, consider adding the CUDA repositories to the snapcraft.yaml and simply add cudart.so as a dependency. Taken from a core 20 example (for core 18 you’d need to adapt the URL and the key-id)
- type: apt
Keeping in mind that you likely only need cudart.so, you might be able to find a more specific package than
Due to the nature of NVidia drivers and CUDA, you’d want to pick the lowest version of libcudart that your application can get away with, since it will indirectly set the minumum required NVidia driver version to run it.