Conversation
|
@tpadioleau can you have a look at this please to see if it aligns with what you had in mind for linking to Gyselalib++? |
69ca3ed to
7392ea6
Compare
6a681a8 to
6e94e02
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #214 +/- ##
=======================================
Coverage 90.70% 90.70%
=======================================
Files 86 86
Lines 9458 9458
=======================================
Hits 8579 8579
Misses 879 879 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tpadioleau
left a comment
There was a problem hiding this comment.
I think this is an improvement, my main concern is whether we should install files related to InputFunctions ?
| find_dependency(OpenMP REQUIRED) | ||
| find_dependency(Kokkos REQUIRED) |
There was a problem hiding this comment.
| find_dependency(OpenMP REQUIRED) | |
| find_dependency(Kokkos REQUIRED) | |
| find_dependency(OpenMP COMPONENTS CXX) | |
| find_dependency(Kokkos) |
This must not be REQUIRED because find_package(GMGPolar) is allowed to fail.
There was a problem hiding this comment.
So REQUIRED in a XConfig.cmake file makes the sub-dependency required for the calling project?
These are required for GMGPolar. If I remove the REQUIRED won't this successfully import GMGPolar if the only thing that is missing is Kokkos?
There was a problem hiding this comment.
So REQUIRED in a XConfig.cmake file makes the sub-dependency required for the calling project?
That is the way I understand, it cannot be optional at this point. The configure and build stages can manage an optional dependency, but once it is determined, installation should whether it is required or not.
These are required for GMGPolar. If I remove the REQUIRED won't this successfully import GMGPolar if the only thing that is missing is Kokkos?
It should not, find_package(GMGPolar) should make GMGPolar_FOUND false.
| target_include_directories(InputFunctions_BoundaryConditions PUBLIC | ||
| ${CMAKE_CURRENT_SOURCE_DIR} | ||
| ${CMAKE_SOURCE_DIR}/include/InputFunctions/BoundaryConditions | ||
| ${GMGPOLAR_INCLUDE_DIRS} | ||
| ) |
There was a problem hiding this comment.
Is it possible to replace by target_link_libraries(InputFunctions_BoundaryConditions PUBLIC GMGPolarLib) ? I think the target GMGPolarLib should be responsible to bring these headers.
There was a problem hiding this comment.
It is possible. This seemed more logical to me as the files in InputFunctions include files that are never used in GMGPolarLib (e.g. the associated .hpp files for these .cpp files) so GMGPolarLib is not needed to compile the InputFunctions for testing.
E.g. in theory we could use InputFunctions in https://github.com/gyselax/gysela-mini-app_poisson even when testing a different solver
| find_dependency(Kokkos REQUIRED) | ||
|
|
||
| if(@GMGPOLAR_USE_MUMPS@) | ||
| find_dependency(MUMPS REQUIRED) |
There was a problem hiding this comment.
| find_dependency(MUMPS REQUIRED) | |
| find_dependency(MUMPS COMPONENTS OpenMP METIS) | |
| find_dependency(Metis) |
| endif() | ||
|
|
||
| if(@GMGPOLAR_USE_LIKWID@) | ||
| find_dependency(LIKWID REQUIRED) |
There was a problem hiding this comment.
| find_dependency(LIKWID REQUIRED) | |
| find_dependency(LIKWID) |
There was a problem hiding this comment.
Is this METIS from https://github.com/KarypisLab/METIS ? I see it is based on CMake, it does not generate its own Config files ?
Does not need to be handled in the PR.
There was a problem hiding this comment.
I didn't check, I just reorganised what was already in the existing CMake files. Probably a question for @mknaranja
There was a problem hiding this comment.
more a comment than a full answer: Yes, this is METIS from Karypis, it is used for mesh / graph partitioning which is used in direct solvers such as MUMPS. But: I couldn't tell you anything about the technical config file question, I never looked at it at that level.
There was a problem hiding this comment.
I never tested Mumps without Metis, but Mumps could be used without it by setting ICNTL(7)=7 if have have issues with that library.
| target_include_directories(InputFunctions INTERFACE | ||
| ${CMAKE_SOURCE_DIR}/include/InputFunctions | ||
| ) | ||
| ${GMGPOLAR_INCLUDE_DIRS} |
There was a problem hiding this comment.
Same question, is it possible to replace by target_link_libraries(InputFunctions_BoundaryConditions PUBLIC GMGPolarLib) ?
| install(TARGETS | ||
| InputFunctions | ||
| InputFunctions_BoundaryConditions | ||
| InputFunctions_DensityProfileCoefficients | ||
| InputFunctions_DomainGeometry | ||
| InputFunctions_ExactSolution | ||
| InputFunctions_SourceTerms | ||
| EXPORT GMGPolarTargets | ||
| ARCHIVE DESTINATION lib | ||
| ) |
There was a problem hiding this comment.
Do they actually need to be installed ?
There was a problem hiding this comment.
I'm not sure. This is a question for @mknaranja . It depends on what you see as being the main functionality of the library.
I would lean towards them not needing to be installed. But if they are I would probably use them for testing GMGPolar vs other solvers
| ${CMAKE_CURRENT_SOURCE_DIR} | ||
| ${CMAKE_SOURCE_DIR}/include/InputFunctions/DomainGeometry | ||
| ) No newline at end of file | ||
| ${GMGPOLAR_INCLUDE_DIRS} |
There was a problem hiding this comment.
Same question, is it possible to replace by target_link_libraries(InputFunctions_BoundaryConditions PUBLIC GMGPolarLib) ?
| ${STENCIL_SOURCES} | ||
| ${INTERPOLATION_SOURCES} | ||
| ${CONFIG_PARSER_SOURCES} | ||
| ) |
There was a problem hiding this comment.
Here we should add add_library(GMGPolar::GMGPolarLib ALIAS GMGPolarLib)
|
Compiles on my machine 👍🏼 |
Co-authored-by: Thomas Padioleau <thomas.padioleau@cea.fr>
HenrZu
left a comment
There was a problem hiding this comment.
@mknaranja requested me to have a look at this. Looks great :) The structure is much cleaner. I left a few minor comments (most are questions as im not really familiar with the structure).
| set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -pedantic -Wno-unused -Wno-psabi -Wfloat-conversion") | ||
| set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -mtune=generic -Wno-psabi") | ||
|
|
||
| set(CMAKE_CXX_STANDARD 20 CACHE INTERNAL "The C++ standard whose features are requested to build this project.") |
There was a problem hiding this comment.
Good catch! I put this in when I removed target_compile_features(gmgpolar_tests PRIVATE cxx_std_20) from src/CMakeLists.txt. I must have assumed that the standard was only set once.
Fixed : f33f81d
There was a problem hiding this comment.
I am fine with targets not being installed but we need this target_compile_features(<target> INTERFACE cxx_std_20) if at least one installed header of the associated <target> requires C++20. This is the CMake way to inform the consumer of GMGPolar::GMGPolarLib of the minimum required.
There was a problem hiding this comment.
With Kokkos C++17, when I build a project including GMGPolar without target_compile_features(GMGPolarLib INTERFACE cxx_std_20), I get
[1/2] /usr/bin/g++-10 -DKOKKOS_DEPENDENCE -isystem /local/home/tpadiole/Codes/GMGPolar/opt/include -isystem /local/home/tpadiole/Codes/GMGPolar/my_env/.spack-env/view/include -std=gnu++17 -fopenmp -MD -MT CMakeFiles/test.dir/main.cpp.o -MF CMakeFiles/test.dir/main.cpp.o.d -o CMakeFiles/test.dir/main.cpp.o -c /local/home/tpadiole/Codes/GMGPolar/subproject/main.cpp
FAILED: CMakeFiles/test.dir/main.cpp.o
/usr/bin/g++-10 -DKOKKOS_DEPENDENCE -isystem /local/home/tpadiole/Codes/GMGPolar/opt/include -isystem /local/home/tpadiole/Codes/GMGPolar/my_env/.spack-env/view/include -std=gnu++17 -fopenmp -MD -MT CMakeFiles/test.dir/main.cpp.o -MF CMakeFiles/test.dir/main.cpp.o.d -o CMakeFiles/test.dir/main.cpp.o -c /local/home/tpadiole/Codes/GMGPolar/subproject/main.cpp
In file included from /local/home/tpadiole/Codes/GMGPolar/opt/include/GMGPolar/gmgpolar.h:8,
from /local/home/tpadiole/Codes/GMGPolar/subproject/main.cpp:1:
/local/home/tpadiole/Codes/GMGPolar/opt/include/InputFunctions/densityProfileCoefficients.h:7:1: error: ‘concept’ does not name a type; did you mean ‘concepts’?
7 | concept DensityProfileCoefficients = requires(const T coeffs, double r, double theta) {
| ^~~~~~~
| concepts
whereas with target_compile_features(GMGPolarLib INTERFACE cxx_std_20) I get
[1/2] /usr/bin/g++-10 -DKOKKOS_DEPENDENCE -isystem /local/home/tpadiole/Codes/GMGPolar/opt/include -isystem /local/home/tpadiole/Codes/GMGPolar/my_env/.spack-env/view/include -std=gnu++2a -fopenmp -MD -MT CMakeFiles/test.dir/main.cpp.o -MF CMakeFiles/test.dir/main.cpp.o.d -o CMakeFiles/test.dir/main.cpp.o -c /local/home/tpadiole/Codes/GMGPolar/subproject/main.cpp
[2/2] : && /usr/bin/g++-10 -DKOKKOS_DEPENDENCE CMakeFiles/test.dir/main.cpp.o -o test -Wl,-rpath,/local/home/tpadiole/Codes/GMGPolar/my_env/.spack-env/view/lib /local/home/tpadiole/Codes/GMGPolar/opt/lib/libGMGPolarLib.a /usr/lib/gcc/x86_64-linux-gnu/10/libgomp.so /usr/lib/x86_64-linux-gnu/libpthread.so /local/home/tpadiole/Codes/GMGPolar/my_env/.spack-env/view/lib/libkokkoscontainers.so.4.7.2 /local/home/tpadiole/Codes/GMGPolar/my_env/.spack-env/view/lib/libkokkosalgorithms.so.4.7.2 /local/home/tpadiole/Codes/GMGPolar/my_env/.spack-env/view/lib/libkokkoscore.so.4.7.2 -ldl /local/home/tpadiole/Codes/GMGPolar/my_env/.spack-env/view/lib/libkokkossimd.so.4.7.2 && :
| @@ -32,7 +32,7 @@ add_executable(gmgpolar_tests | |||
|
|
|||
| # Set the compile features and link libraries | |||
There was a problem hiding this comment.
why do we use the project() at the top of this file?
This way, we need to set CMAKE_CXX_STANDARD 20 again.
This is already included due tothe add_subdirectory(tests). Maybe we can remove the the configuration lines from the tests/CmakeLists
There was a problem hiding this comment.
Somehow I missed this, I agree that there does not need to be a second project : 0bacedc
| if(GMGPOLAR_BUILD_TESTS) | ||
| enable_testing() | ||
| add_subdirectory(third-party) | ||
| find_package(GTest 1.17) |
There was a problem hiding this comment.
Since we explictly handle if Gtest is not found, we might use find_package(GTest 1.17 QUIET) here.
See https://cmake.org/cmake/help/latest/command/find_package.html
| @@ -32,7 +32,7 @@ add_executable(gmgpolar_tests | |||
|
|
|||
| # Set the compile features and link libraries | |||
| target_compile_features(gmgpolar_tests PRIVATE cxx_std_20) | |||
| target_link_libraries(convergence_order PRIVATE GMGPolarLib) | ||
| target_link_libraries(weak_scaling PRIVATE GMGPolarLib) | ||
| target_link_libraries(strong_scaling PRIVATE GMGPolarLib) | ||
| target_link_libraries(gmgpolar PRIVATE GMGPolarLib GMGPolarInterface) |
There was a problem hiding this comment.
im not really familiar with the structure. But these executables are built but not installed. Is this intentional? If yes, maybe add a comment :)
There was a problem hiding this comment.
This is where we need feedback from the GMGPolar team. It is related to the comment above : #214 (comment)
It depends on how you see GMGPolar.
Is it a library? I.e. something designed to provide tools to other bigger tools (e.g. simulations, gyselalib++, etc)
Or is it a tool in its own right? I.e. does it make sense to have access to the executables but not the code?
My impression was that it is more of a library so I have implemented it like this for now. But that also raises the question of whether GMGPolarInterface should be included in that library or not?
In any case I suspect that it does not make sense to install convergence_order, weak_scaling and strong_scaling as I'm not sure these are particularly useful if you can't modify the code to try different test cases?
There was a problem hiding this comment.
I think if you would export it as a library than you might need the sourceTerm.h concept definitions, but not all source term specific test case examples.
And the main.cpp etc are just for testing purposes and are probably also not part of a library.
There was a problem hiding this comment.
The current setup is:
- All include files are installed
- Everything except
src/ConfigParser/*andsrc/InputFunctions/*is compiled into theGMGPolarLibtarget src/ConfigParser/*andsrc/InputFunctions/*are compiled into aGMGPolarInterfacelibrary
As an example of end users:
- gyselalib++ would use
GMGPolarLibto provide a solver for the equation and would be happy to not have to compileGMGPolarInterface - gysela-mini-app_poisson (a mini-app designed to compare different solvers) would do the same but could also use
GMGPolarInterfaceto avoid having to write our own test cases.
Clean up CMake files to follow standard practice. In particular:
find_packagecalls are moved to the rootCMakeLists.txtso dependencies are easy to locatecmake/FindX.cmakefiles so they can be located via a standardfind_packagecallInputFunctions(which is only required for testing and for the CLI) is removed from theGMGPolarLibtargetGMGPolarInterfaceis added to group example input functions and other tools required for the command line interface.if(OpenMP_CXX_FOUND)is removed as OpenMP is a required dependency so this should always be Trueinclude/folder is included via the compile commandfind_package(GMGPolar)Merge Request - GuideLine Checklist
Guideline to check code before resolve WIP and approval, respectively.
As many checkboxes as possible should be ticked.
Checks by code author:
Always to be checked:
If functions were changed or functionality was added:
If new functionality was added:
If new third party software is used:
If new mathematical methods or epidemiological terms are used:
Checks by code reviewer(s):