Pkg App + Extensions

For a numerical model we use KernelAbstractions for GPU accelerated code. To support every backend we make use of extensions, so that a user with an AMD GPU does not need to install and precompile CUDA packages (for example).

We would also like a simple command line setup instead of scripts/eval, to ensure that Julia is launched with multiple threads by default, and that the right backend is loaded. This would allow users to call the model with:

modelapp path/to/config -b CUDA

Which experiments more reproducible and less error prone (if CUDA or NVIDIA GPU isn’t available the CLI will return an error).

The Pkg App system allows for creating a command line interface for a package. However, this does not seem to work well with extensions, as the app is part of the main module.

Has anyone else run into this issue?

The most viable solution/workaround seems to be to create a separate package with only the CLI app, which has the model as a dependency and loads the backend from the general environment before the model code is imported.

1 Like