We have a successful build of Pytorch from the source code on Windows with APL. But while trying to use we are getting errors such as:
RuntimeError: svd: LAPACK library not found in compilation.
Can you point me to the right direction of understanding the problem? We followed the Windows guidelines but maybe we are not linking something correctly or not linking at all.
Hi Irem,
Would you be able to provide some more details of how you're building PyTorch and linking to Arm PL?
PyTorch might not be able to idenify ArmPL correctly during the build, it may not think it provides LAPACK.
I believe that, in order for PyTorch to have full BLAS and LAPACK support from Arm PL, it should think that it's linking to a lib. with BLAS and LAPACK support (like OpenBLAS), rather than one that only provides BLAS functionality (like BLIS). You may be able to see from the build log how it has identified Arm PL.
You should be able to force PyTorch to treat Arm PL as if it were OpenBLAS by setting `BLAS="OpenBLAS"` as well as setting `OpenBLAS_HOME` to the location of Arm PL. In this case it should support both BLAS and LAPACK.See, for example, this Linux build script: github.com/.../build-pytorch.sh
Hope that helps,Nathan.
We actually added APL as a BLAS option, so I use BLAS=APL and have this cmake file for linking purposes.
Hi,
In that case you could try adding a case for "APL"` in the `FindLAPACK.cmake` file - https://github.com/iremyux/pytorch/blob/run-test-apl-results/cmake/Modules/FindLAPACK.cmake too.Cheers,
Nathan.
Hi,One more thing to check - are you setting `USE_LAPACK=1` for the build (see the cmake build line in the Linux example linked to above (github.com/.../build-pytorch.sh),
Cheers,
Thanks a lot for your answer. I realized that and built again setting USE_LAPACK to 1. The error did not disappear.
On CMakeCache, I can see this variable as :
//No help, variable specified on the command line.USE_LAPACK:UNINITIALIZED=1
Is USE_LAPACK really defined and being used?
I think that's just telling you it has been set at the command line? it doesn't confirm that it's being used (or not) anywhere. `UNINITIALIZED` is the type, which is unspecified if you use `-DUSE_LAPACK=1`. You can set a type (the syntax is `-D MY_CMAKE_COMMAND:<type>=<value>`) but you don't need to, CMake is not strongly typed.It sounds like you need to make FindLAPACK.cmake aware of the "APL" BLAS option you've added, so that when it checks for LAPACK support (by looking for an LAPACK symbol in the supplied BLAS binary) at compile time, it knows to look in the Arm PL binary, and confirms that it has LAPACK symbols.
Hi Nathan, thanks a lot for the reply, we were not aware of those and it seems to be working now.
Great stuff, glad to hear it! Thanks for letting me know.