-
Notifications
You must be signed in to change notification settings - Fork 6
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
Build system improvements for CABLE offline #188
Comments
@harshula and I have scoped out solutions to address these issues. In short, we have concluded that moving to a CMake based build system is the best approach. Addressing the requirements with CMake
CMake advantages:
CMake disadvantages:
Consequences of moving to CMakeIt is currently not possible to transition to CMake without breaking binary equivalence with the current build due to parts of the build system which are automated in CMake. To demonstrate binary equivalence when moving to CMake, the current build system will have to be massaged into the CMake way of doing things. The required changes include:
|
Just a general comment here. The make tools will only apply to offline/. The future of which is less than certain, however likely to be around for at least 5 years even if we do adopt the JAC-Standalone route. But my main comment is that the intention of the existing Makefile(s), build scripts (apart from building an execuable) was to be transparent and easy to amend by developers. Potential developers/users are familiar with 1970s Makefiles, shell scripts etc. A large cohort of users will be on the NCI platform, where I suspect you have been developing this system so obviously the tools are available. However, an equally large cohort are not. In the past questions from new users about building etc have been unrelated to available tools as there is (I doubt) any UNIX/linux system that does not have bash, make etc. Is this going to be a problem? Docs on how to build will require updating to describe all of this. |
Hi, While reviewing the existing build system, our observation was that the Makefile build system has been improperly amended by developers over time. Our understanding is that CMake automates a number of important steps, particularly module dependencies for Fortran projects. This may allow model developers to focus more on the Fortran code and reduce the changes to the build system. |
@JhanSrbinovsky for tools availability, it is true that CMake isn't always available on all systems by default but it is very easy to install. I would think it is available on all supercomputers nowadays and it is available via Homebrew for Macs. For ease of development, as Harshula said, if it is well done it might reduce the need for changing the build system following the development of CABLE hence making it simpler for development work. |
@ccarouge, fine with me. I gave up long ago on running CABLE locally anyway. In fact, we officially gave up on trying to support CABLE on anything less than at least a dedicated HPC system. The overwhelming majority of build issues were related to external tools/libs |
In preparation for building CABLE with [spack](https://spack.io/), @harshula, @ccarouge and I have found areas where the current build system for CABLE offline can be improved (see #188 for more details). This change adds a [CMake](https://cmake.org/) based build system to address these issues: - #190 Although this problem can be solved in the Makefile by specifying the relative paths to each source file, it requires updating all the Makefile Fortran module dependency rules which is a pain. CMake automatically handles Fortran module dependencies out of the box so doing this with CMake is much easier. - #191 When invoking `cmake`, custom options, compilers and compiler flags can be configurable by setting the appropriate variables via the [`-D` flag](https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-D), for example: `cmake -DCMAKE_Fortran_COMPILER="mpif90" -DCMAKE_Fortran_FLAGS="-O2 -fp-model precise" -S . -B build`. These can be used for doing MPI only builds and enabling specific debug flags. - #192 As mentioned above, CMake automatically handles Fortran module dependencies out of the box. Parallelised builds can be done by specifying the `-j` flag to `cmake`. The following pull requests should be merged before this pull request so that we can demonstrate binary equivalence between the executables compiled by both Makefile and CMake builds. This ensures no unwanted changes are introduced by the transition. - [x] #197 - [x] #199 Edit: the above PR's have been merged - the serial and MPI binaries built by CMake (in release mode) are equivalent to the binaries built by the Makefile based build system in the main branch. Fixes #188, #190, #191, #192 <!-- readthedocs-preview cable start --> ---- 📚 Documentation preview 📚: https://cable--200.org.readthedocs.build/en/200/ <!-- readthedocs-preview cable end -->
In preparation for building CABLE with spack, @harshula, @ccarouge and I have found areas where the current build system for CABLE offline can be improved.
serial_build
andparallel_build
functionality into Makefile #189serial_build
andparallel_build
build scripts can go in the Makefile by creating rules specific to serial or mpi. This simplifies the build system by reducing the number of scripts. See here as an example.make
in that directory. This can make debugging confusing as debug information will point to the source code in the temporary directory rather than the actual source code. The Makefile should be able to handle the compilation without the need for a temporary directory (see a draft implementation of this here). Removing this from the build system will also simplify thebuild3.sh
build script.make -j
.The text was updated successfully, but these errors were encountered: