-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop backend dispatch pattern #6
Comments
I think there are a handful of uses cases the libraries in lisp-stat should support:
NumPy and CuPy solve this through the import trick. They use the same underlying function names and then just import it into the same name import NumPy as np equivalent I believe to (rename-package :cucl as :numcl) assuming the libraries in CL where named cucl and numcl. Tensorflow does what you are suggesting. I checks if CUDA is installed and then dispatches to CUDA instead of the regular libraries. I think the rename-package approach is much easier to maintain and extend. |
That's an interesting idea. The systems could remain separate, and yet be simply swapped out. Good thinking. I'd suggest using a package-nickname or import-from or for this, as it's closer to the Python import mechanism and causes less problems for other packages. |
This is now agreed and we can close it once we document the pattern and provide a few examples. |
One of the things we're going to need is a good pattern for dispatching to various backends. Here's one possible pattern that I used for a scatterplot smoother:
As I start to use it, I think it's more of an anti-pattern because:
*features*
in a non-specific way I don't likeI know that MGL-MAT has a way to automatically dispatch methods depending on whether BLAS or CUDA are available. Generally his architecture seems similar to that of linear-algebra, with various 'kernels' (lisp, CUDA, BLAS) that are operated on by lisp code. It might be worth studying.
The text was updated successfully, but these errors were encountered: