A package with multiple support for multiple GPU types

Hey all!

I’m currently working on a package that uses the GPU. Being a good citizen, I’m adding support for different pipelines (via KernelAbstractions.jl, if that helps). How should I architect this in the package?
I obviously don’t want the user installing oneApi.jl if they have CUDA, but how can I make Pkg.instantiate() platform specific?

Thanks!

I think the easier and more recommended option is not to have the backends as deps, but make the user install what he/she wants to use and then somehow communicate to the package that. Can’t you do so?

Do you have an app package or a library package?

For a library package, you probably should not have a Manifest.toml, so there should not be a problem with instantiate to begin with.

For an app package, I think the user should be free to choose on their own (they might even decide to use the CPU because their GPU is busy with some other stuff). Using preferences and potentially package extensions might help. As far as I know there are no union dependencies, so you can’t depend on oneAPI.jl OR CUDA.jl.

You might also be interested in the following packages:

  • Adapt.jl
  • GPUSelect.jl
  • JACC.jl