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

Additional CMake changes #215

Closed
3 tasks
SeanBryan51 opened this issue Mar 1, 2024 · 0 comments · Fixed by #216
Closed
3 tasks

Additional CMake changes #215

SeanBryan51 opened this issue Mar 1, 2024 · 0 comments · Fixed by #216

Comments

@SeanBryan51
Copy link
Collaborator

SeanBryan51 commented Mar 1, 2024

See #200 for the initial implementation of a CMake based build system. This issue documents changes that should follow after this pull request:

  • List source files in alphabetical order in CMakeLists.txt. The order of source files was chosen so that we could demonstrate binary equivalence in executables between the CMake build and the Makefile build.
  • Use find_package(MPI REQUIRED) instead of specifying mpif90 when invoking cmake for MPI case. This is done so that
    1. We can create separate targets for the serial and MPI executable and only link against the MPI libraries when needed without relying on the MPI compiler wrapper. This lets us compile all executables (serial and parallel) with a single invocation of CMake.
    2. We can use object libraries to compile the object files common to
      both serial and MPI builds. This saves compiling these object files for
      each executable (serial and MPI), reducing compilation time.
  • The previous task also lets us remove the MPI option from build script. The same can be achieved by specifying --target cable-mpi when invoking CMake.

Originally posted by @SeanBryan51 in #200 (comment)

@SeanBryan51 SeanBryan51 linked a pull request Mar 1, 2024 that will close this issue
SeanBryan51 added a commit that referenced this issue Mar 15, 2024
This pull request should follow after the CMake implementation (see
#200). This change adds the following build system changes:

- List source files in alphabetical order in CMakeLists.txt. The order
of source files was previously chosen so that we could demonstrate
binary equivalence in executables between the CMake build and the
Makefile build.
- Use [`find_package(MPI
REQUIRED)`](https://cmake.org/cmake/help/latest/module/FindMPI.html)
instead of specifying `mpif90` when invoking `cmake` for MPI case. This
is done so that
1. We can create separate targets for the serial and MPI executable and
only link against the MPI libraries when needed without relying on the
MPI compiler wrapper. This lets us compile all executables (serial and
parallel) with a single invocation of CMake.
2. We can use object libraries to compile the object files common to
both serial and MPI builds. This saves compiling these object files for
each executable (serial and MPI), reducing compilation time.
- Portability fixes and improvements to build.bash.
- Add `--compiler` flag to build.bash and GNU compiler support.
- Add Matthias's configuration for example.

Regression tests using
[benchcab](https://github.com/CABLE-LSM/benchcab)* (bitwise comparison
of model output via nccmp) show that model output is bitwise identical
between the current branch and the main branch for serial and MPI model
runs.

*executables were built manually as benchcab does not yet support the
recent build system changes (see related issue:
CABLE-LSM/benchcab#258).

Fixes #215

<!-- readthedocs-preview cable start -->
----
📚 Documentation preview 📚:
https://cable--216.org.readthedocs.build/en/216/

<!-- readthedocs-preview cable end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant