Fast KroneckerProduct.matmul, t_matmul and rmatmul#103
Fast KroneckerProduct.matmul, t_matmul and rmatmul#103abhijangda wants to merge 4 commits intocornellius-gp:mainfrom
Conversation
|
It looks like the CI uses Python 3.8. PyFastKron is build for Python >= 3.9 because PyTorch requires >= 3.9. I can build PyFastKron for 3.8 but I think ideal would be upgrade the Python in CI to >= 3.9 . Let me know what you prefer. |
|
We should just upgrade to 3.9+ as py3.8 is EOL anyway. cc @jandylin, @SebastianAment re the Kronecker library |
|
Thanks for upgrading the Python version to 3.10. It looks like a workflow approval is needed to execute CI tests. Would be great if you can approve it and I am happy to answer any questions about FastKron. |
Can you share the benchmarks that you ran for this? |
|
Install pyfastkron using pip: Clone the repository including submodules: I also recommend installing TCMalloc using To evaluate Matrix Kronecker-Matrix (MKM) product (rmatmul in linear_operator) and Kronecker-Matrix Matrix (KMM) product (matmul in linear_operator) using Float and Double on CPU: Similarly, for an NVIDIA GPU: The above scripts use |
|
Also, existing results for some benchmarks over GPyTorch on V100/A100 and AMD CPUs with AVX and AVX512 are here: https://github.com/abhijangda/FastKron/blob/main/documents/performance.md . |
|
Hello, I was wondering if you were able to run these benchmarks and if there are any more questions. |
Hello linear_operator developers,
I have developed a library, FastKron (https://github.com/abhijangda/fastkron), to do fast matrix kronecker-matrix multiply and kronecker-matrix matrix multiply. FastKron performs orders of magnitude faster (0.9x to 21x) than current algorithm on both x86 CPUs and NVIDIA GPUs. The python module, PyFastKron, provides a PyTorch interface with backward pass. You can find more information at https://github.com/abhijangda/fastkron .
This PR integrates KroneckerProductLinearOperator._matmul, KroneckerProductLinearOperator._tmatmul, and KroneckerProductLinearOperator.rmatmul. Looking forward to your reviews and happy to do any changes.
Thank You