-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add cmake support for the c code. #38
base: master
Are you sure you want to change the base?
Conversation
@phcerdan thanks for the pull request! This project is currently lacking of a convenient way to generate a C library of the core algorithms, so this might be useful. However I have never used cmake. Could you give me an example on how the library is compiled, then linked into the compilation of the test program you have added? I might want to include this process both in the docs and in the CI tests. I have tried the cmake line you wrote above but I'm unsure about from which directory one is supposed to run it. If I just run
at the project root folder I get the following error:
I'm think I have the correct lapack and lapacke libraries installed, as the python installation works alright. |
7661cd0
to
aeaa2c6
Compare
Hi @albarji, glad that you find it useful too! The Lapacke issue (that I wasn't having in my system) is because only the latest versions of I have written a c-interface in the readme, let me know if I should put it after the python/matlab interfaces, or if you find a way to structure it better. To run I have also created a dummy_project to test if the generated libproxTV (and its proxTVConfig.cmake) can be found from an external cmake project, and it does!. See this. Also, I have reorganized the CMakeFiles, the main one is now living in the top folder (not in |
aeaa2c6
to
c02cfe1
Compare
Thanks @phcerdan ! I'm currently tangled up in other projects, but will take a more thorough look into this once I find the time. |
@albarji I will use my branch to use the c-interface of proxTV to other cmake project, so no hurries. |
Hi @albarji, I asked in the cpp-slang channel for a review of the code, to be in the safe side, and correcting minor things. I would appreciate if you test it with your Lapacke version (modern versions of that library generate cmake code, so FindLAPACKE is not needed). |
Hey @phcerdan , I have to apologize for my lack of answers. In all honesty, I have been neglecting this project for all these months, in favor of other ones I'm developing right now. I hope I can find some time during the summer to properly test this and merge your additions! |
@albarji I understand, I don't have much time either lately in the project I wanted to do using this library. But let's try to find some, from your side probably you only need to give a try and perform a couple of tests! I think the cmake files should be good enough, and if problems arise, we can tweak it. Let me know if I can help further. |
Hi again @phcerdan , finally found time to check this out. I have tried following the instructions you added to the README.md file, but still to no success. This is the error I get back when running cmake:
I have been googling for the errors appearing on top of the trace, but I only found answers regarding badly configured CMakeLists.txt. This does not seem to be the case, but then again I have no prior experience with cmake. Any idea what could be wrong? |
Wierd error indeed. I will test it again once I am on a computer. But meanwhile, from my prior experience with CMake, I have to ask: are you testing it in a new build folder or using the same folder you were using months ago? If the second, try to clean the build the folder and start again. |
I started from a new checkout from github, and the build folder I'm using is a new one. |
I cannot reproduce it, I can configure without problems. It might be related to the cmake version, and the Related: jasper-software/jasper#161 |
No luck, I'm afraid
But I did a little bit more testing and it seems it's a problem with my environment. I tried in a fresh Ubuntu container and after installing build-essential, libopenblas-dev, liblapack-dev and liblapacke-dev I get the following
So for some reason cmake can't find LAPACKE. To avoid this kind of environment-dependent issues I implemented in the past some automated tests in Travis, which you can check here. I think the easiest way to sort this is to add some tests there that run the cmake compilation and the C test program you prepared. This way we will be sure that your additions work as expected. I just modified my Travis configuration so that further commits into this push request will go through the tests automatically. Could you add the tests to your branch? I guess modifying .travis.yml to look as follows should work:
|
That's probably a Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/openblas/+bug/1728068 But should we able to work-around it, related: opencv/opencv#9953 (comment) |
Umm, I think the best would be to require a modern lapacke version (3.6.1 at least), so we can forget about maintaining the homemade I will try to set-up the travis as you suggested. |
1 similar comment
600d2b9
to
faf5c3a
Compare
Uff, travis use trusty (2014) and it is just getting dated for the lapacke purposes. I'll keep trying soon, maybe even with a docker version for travis. |
I have been checking the travis docs, and indeed the "newest" version supported is trusty. But I can change the travis script to run the tests inside a docker container with xenial. Let me try that and I will tell you whether it works out. |
@phcerdan I created a branch with a tuned .travis.yml that makes use of Docker containers to run under xenial. It's not pretty, and I had to drop support for the oldest python versions, but it works. Check it out at https://github.com/albarji/proxTV/blob/feature/travis-xenial/.travis.yml . If this works for you too then I will merge it to master. |
6147a8d
to
7a82d57
Compare
@phcerdan I just merged a big change in the way the library is built and tested. Now I create precompiled python wheels for Linux and Mac, and upload them to PyPI for easier install. For building the Linux wheels in a way that is compatible with all linux distributions I need to run the tests inside a CentOS 5 container, so now I'm running all tests there. I'm unsure whether this makes things easier or harder for the C compilation and testing. |
That line is the RSA-encrypted password used to upload the package to PyPI. The encryption is made using Travis public key for this repository, so only Travis jobs on this very same repo can access the private key to unencrypt the password and make use of it. This seems to be the standard way of dealing with secrets in public repositories: https://docs.travis-ci.com/user/environment-variables#defining-encrypted-variables-in-travisyml |
Cool, it was the first time I was seeing that in a travis file, so, better to check with you it wasn't sensible info. Thanks for the explanation! |
56d7260
to
96e4aa4
Compare
Add dummy test checking if linking works properly. Add FindLAPACKE.cmake and export proxTVconfig.cmake. FindLAPACKE.cmake is used to handle lapacke installations with no export targets. Also complete the generation of proxTVconfig.cmake Add a dummy project to test usage of proxTV from external project. Add C Interface to Readme Remove Foo_FOUND in the case FOO is REQUIRED Update cmake required version to 3.5 This simplifies policy and version set up. Require a modern lapacke and remove FIND_LAPACKE This will look for a `lapacke-config.cmake`, that is generated since lapacke version 3.6. And allow us to remove the buggy FIND_LAPACKE. Add test for cmake in travis. Restore FindLAPACKE.cmake Because travis still uses ubuntu 14.04, with an old lapacke which does not provide config.cmake. Fix CMake Added FindLAPACK FindLAPACKE CONFIG is not populating LAPACK. From @jcfr branch: https://github.com/jcfr/proxTV/tree/cmake_support_squashed Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]> WIP: Avoid deploy in .travis Also install cmake with pip (3.12) Also use find_package(LAPACKE NOCONFIG) for old librart versions Error: ``` +twine upload --repository-url https://test.pypi.org/legacy/ --username albarji dist/prox_tv-3.3.0-cp27-cp27mu-manylinux1_x86_64.whl Enter your password: No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself. Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received ```
2ed4393
to
b0f34a2
Compare
What is the status of this PR? |
Development of this feature (and the option to use Eigen instead of Blas/Lapack) is going on in my fork on this branch: https://github.com/phcerdan/proxTV/tree/use_eigen |
Maybe I should rephrase the question: @albarji do you have any intention of merging this PR? |
Add a CMakeLists.txt file in
src/
folder to compile the c code into a library. CMake is specially useful for integrating the code with other projects using cmake.Also, Add dummy test checking if linking works properly.
cmake ../proxTV/src -DCMAKE_INSTALL_PREFIX=./install -DENABLE_TESTING:BOOL=ON