Skip to content
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

CMake refactor and fix examples. #190

Merged
merged 8 commits into from
Dec 14, 2021
Merged

Conversation

vaithak
Copy link
Collaborator

@vaithak vaithak commented Nov 13, 2021

  • CMake will now download all external dependencies (Eigen, boost, lpsolve) in external/_deps, this prevents multiple downloads of these libraries.
  • Combined all cmake files for downloading external dependencies into a single source of truth in external/cmake-files directory - closes Put all .cmake files in one directory  #151.
  • Enabled build of individual examples, also updated their README files with description.
  • Removed parts of CMakeLists.txt from examples/logconcave and examples/mmcs_method which were already present at the root of examples.
  • Added README in hpolytopeVolume and vpolytopeVolume examples.

@vaithak vaithak changed the title Cmake refactor and fix examples. CMake refactor and fix examples. Nov 13, 2021
@vaithak
Copy link
Collaborator Author

vaithak commented Nov 13, 2021

@vissarion, @TolisChal It would be great if codecov's app can be integrated with Github - link. This will allow codecov comments on every PR regarding coverage changes.

@vissarion
Copy link
Member

@vissarion, @TolisChal It would be great if codecov's app can be integrated with Github - link. This will allow codecov comments on every PR regarding coverage changes.

Sure, is this process needed? Why not simply enabling coverage comments as described in https://docs.codecov.com/docs/pull-request-comments ?

@vaithak
Copy link
Collaborator Author

vaithak commented Nov 19, 2021

@vissarion, @TolisChal It would be great if codecov's app can be integrated with Github - link. This will allow codecov comments on every PR regarding coverage changes.

Sure, is this process needed? Why not simply enabling coverage comments as described in https://docs.codecov.com/docs/pull-request-comments ?

Yup, the setup process is needed. The coverage comments are enabled by default in the config, but for the bot to actually post the comments it requires the setup process.

@vissarion
Copy link
Member

vissarion commented Nov 19, 2021

Thanks for this PR! I am ok with merging in general. But since you did this would it make sense to fix example issues and optionally build them in CI (only in actions is ok). For example, we are still getting errors while compiling them with the new cmake

fatal error: Eigen/Eigen: No such file or directory
    3 | #include "Eigen/Eigen"

in ellipsoid2d-sampling.cpp

EDIT: in particular you are getting the above error if you run cmake . in an example folder and no makefile is generated if you run cmake ..

@vissarion, @TolisChal It would be great if codecov's app can be integrated with Github - link. This will allow codecov comments on every PR regarding coverage changes.

Sure, is this process needed? Why not simply enabling coverage comments as described in https://docs.codecov.com/docs/pull-request-comments ?

Yup, the setup process is needed. The coverage comments are enabled by default in the config, but for the bot to actually post the comments it requires the setup process.

OK thanks, could you open an issue to think/discuss it and put it on schedule.

@vaithak
Copy link
Collaborator Author

vaithak commented Nov 19, 2021

EDIT: in particular you are getting the above error if you run cmake . in an example folder and no makefile is generated if you run cmake ..

Please see the new instructions for building examples (present in the README file for each example).
For example, to build ellipsoid-sampling, you will have to run the following steps in the examples/ellipsoid-sampling folder:

cmake .. -DEXAMPLES=ellipsoid-sampling
make

i.e, if you don't pass any example name in the -DEXAMPLES parameter to cmake, then no MakeFile will be generated.

@vissarion
Copy link
Member

I see, thanks for the explanations! However, I find the use of -DEXAMPLES variable a bit confusing. Is there a technical reason for that? Since just cmake .. in a directory is simpler and clear.

Another issue I see is the creation of a new directory ellipsoid-sampling inside the examples/ellipsoid-sampling with the executable and some extra makefiles and cmakefiles. Is this needed? Is it simpler to just create one executable file as before?

@vaithak
Copy link
Collaborator Author

vaithak commented Nov 19, 2021

I see, thanks for the explanations! However, I find the use of -DEXAMPLES variable a bit confusing. Is there a technical reason for that? Since just cmake .. in a directory is simpler and clear.

Although cmake .. is simpler, but using -DEXAMPLES is useful when the person only wants to test out a particular example and so doesn't have to install dependencies for the successful build of other examples.
For example:
Consider the case when the user just wants to run the hpolytopeVolume example. If we used the earlier method of cmake .., then this will also require the user to have MKL and BLAS installed because examples/logconcave requires it. Thus, the user has to install a dependency which they may never require. By passing -DEXAMPLES=hpolytopeVolume, CMake won't include any other dependencies other than those required by that particular example.


Another issue I see is the creation of a new directory ellipsoid-sampling inside the examples/ellipsoid-sampling with the executable and some extra makefiles and cmakefiles. Is this needed? Is it simpler to just create one executable file as before?

I am not facing this on my system and it should not happen, because the whole procedure is exactly the same as earlier other than the exclusion of non required example files.

@vissarion
Copy link
Member

Although cmake .. is simpler, but using -DEXAMPLES is useful when the person only wants to test out a particular example and so doesn't have to install dependencies for the successful build of other examples. For example: Consider the case when the user just wants to run the hpolytopeVolume example. If we used the earlier method of cmake .., then this will also require the user to have MKL and BLAS installed because examples/logconcave requires it. Thus, the user has to install a dependency which they may never require. By passing -DEXAMPLES=hpolytopeVolume, CMake won't include any other dependencies other than those required by that particular example.

OK, this makes sense, but then there should be a way to generate all examples in once and the intuitive way of doing this, I think, is cmake .

I am not facing this on my system and it should not happen, because the whole procedure is exactly the same as earlier other than the exclusion of non required example files.

I see, I was running cmake .. inside the ellipsoid-sampling directory. It seems that there exist enough space for the user to create nasty structures.

I think it is cleaner to have one self-contained folder per example, with one CMakeList.txt and the .cpp inside and optionally other useful files.

@vaithak
Copy link
Collaborator Author

vaithak commented Dec 3, 2021

Hi @vissarion, I agree with your comment above that there is enough space for user to mess up somehow, also each example should be self contained. So, I am thinking of having a separate and self contained CMakeLists.txt (will depend on external/cmake-files though) in each example's folder, this will enable a user to build each example independently.

Regarding the use case that you mentioned of building all examples together, I think this will be required more for testing purposes (like verifying if all examples are building), which can be done in the future by using a separate bash/python script in the root examples folder.
WDYT?

@vissarion
Copy link
Member

Hi @vissarion, I agree with your comment above that there is enough space for user to mess up somehow, also each example should be self contained. So, I am thinking of having a separate and self contained CMakeLists.txt (will depend on external/cmake-files though) in each example's folder, this will enable a user to build each example independently.

I totally agree here, that would be much clearer.

Regarding the use case that you mentioned of building all examples together, I think this will be required more for testing purposes (like verifying if all examples are building), which can be done in the future by using a separate bash/python script in the root examples folder. WDYT?

Yes, that would not be a problem.

@vaithak
Copy link
Collaborator Author

vaithak commented Dec 9, 2021

made the changes 👍🏽 as discussed above.

Copy link
Member

@vissarion vissarion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks I am OK with merging. As a side note, a few examples are not compiling but this is an issue probably not related to this PR. We could open an issue and fix it later. It would also be useful to compile (not run) examples on CI.

@vissarion
Copy link
Member

@papachristoumarios @TolisChal what do you think of this PR?

@vissarion vissarion merged commit c9cc0ec into GeomScale:develop Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Put all .cmake files in one directory
3 participants