-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Use common/simpler FindArmadilo.cmake (and BLAS/LAPACK) #2215
Comments
I'm not sure if The specific lines of code in |
Hi, can I work on this issue?? I don't have a lot of experience with cmake, so if you can guide me with how to get started it would be great. |
Some guidance would be really helpful as even I don't have any experience with cmake and would like to learn |
To add some context, cmake >=3.6.0, find_package finds lapack, blas, and armadillo without requiring any special setup (in most circumstances at least). First, you could copy the findLapack and findBlas cmake files distributed with newer versions of cmake here, and apply something resembling this patch to cmake lists. I'd recommend testing different ways of acquiring blas and lapack on windows while testing this, since the patch was only concerned with vcpkg. If you want to look deeper, mlpack's FindArmadillo.cmake has a lot of custom pseudo modules for finding blas/lapack/mkl etc. If we used cmake's own findArmadillo along with the findLapck and findBlas as above, it would greatly simplify the mlpack cmake configuration. In short, either case would need to be accompanied by a fair amount of testing. I'm not even sure if all of the above linked findX.cmake files are compatible with cmake 3.3.2 as mlpack currently uses. |
I'd strongly suggest that anyone wanting to work on this issue be familiar with CMake: CMake is our build system and so changes to it affect every single person who builds the library. So I am pretty paranoid about the CMake setup and I think we all should be. :) @birm I think that we can use only mlpack's Let me know if you think otherwise; I'm open to other ideas for sure, I just wrote down what I was thinking. :) |
This, is based mostly on my thoughts rather than any testing at this point. With that disclaimer out of the way... If I'm reading mlpack:FindArmadillo right, it tries to find a blas compatible and a lapack compatible library on the system, and it puts them all in a variable ARMADILLO_LIBRARIES. However, since we're not building armadillo, it's not armadillo that needs to link to lapack and blas, but mlpack. Thus, I think in the case where ARMA_USE_WRAPPER is defined just using find_package on blas lapack and then armadillo. In the case where we aren't wrapping armadillo, then I think the only difference would be that we don't have a library to link to. We probably will want to incorporate mlpack:FindArmadillo.cmake's system for determining how to set ARMA_USE_WRAPPER, since it looks like CMake:FindArmadillo.cmake doesn't account for wrapping at all. Or we could ask the user to just tell us. I'll test this theory next week (or sooner if time somehow allows) if someone doesn't beat me to it. |
Sorry for the slow response. What you wrote is pretty close to the intention of the CMake scripts but let me add a few extra details--- You're exactly right that FindArmadillo.cmake tries to find LAPACK and BLAS libraries and adds them to ARMADILLO_LIBRARIES... but it should only be doing this when ARMA_USE_WRAPPER is set. Basically, if ARMA_USE_WRAPPER is set, then there will be a file In essence, this wrapper means you can compile a program that uses Armadillo by linking with only On Windows, it seems that linking only to Armadillo does not work; I think this is because the nature of linking is different on Windows. Therefore, our existing CMake scripts require the locations of BLAS_LIBRARY and LAPACK_LIBRARY in order to link directly against them. So where I am going with all of this is that I think we can achieve this same behavior through FindArmadillo.cmake. Perhaps it might need just a little modification to specify that ARMADILLO_LIBRARIES should be filled with all the dependencies even if ARMA_USE_WRAPPER is set. I typed all that on a phone... my thumbs hurt now 😵 |
Any PR relate to this. After mlpack/models#49 |
I don't think there's anything as of yet and I'm a bit busy so go ahead with it I guess. Just confirm with @codeboy5 to make sure he isn't working/worked on it already |
No I am not working on this issue, feel free to go ahead !!! |
@codeboy5 @PranavReddyP16 thanks for confirmation |
This is related to #2113, at least in the sense that it would help simplify CMakeLists.txt
Armadillo, BLAS, and LAPACK have nice and simple preexisting cross-platform FindX.cmake files in the cmake repo (and thus shipped with most newer versions of Cmake) which would help remove some special configuration done.
Note that this would also involve slight modifications to the test pipeline related changes made in mlpack/models#52 so that it would no longer have to patch CMakeLists.txt
The text was updated successfully, but these errors were encountered: