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

Runtime debug information #679

Merged
merged 6 commits into from
Nov 21, 2023
Merged

Conversation

program--
Copy link
Contributor

@program-- program-- commented Nov 20, 2023

This PR adds the capability to call ngen --info to provide debugging information regarding the user's environment at runtime, instead of only at build-time. This is to address the main concern of providing support to users where the capabilities of their executable are not provided, i.e. NGIAB containers.

Example Output
user$ ngen --info
NGen version: 0.1.0
Build configuration summary:
  Generator: Ninja
  Build type: Release
  System: Linux
  C Compiler: /usr/bin/clang
  CXX Compiler: /usr/bin/clang++
  Flags:
    NGEN_WITH_MPI: ON
    NGEN_WITH_NETCDF: ON
    NGEN_WITH_SQLITE: ON
    NGEN_WITH_UDUNITS: ON
    NGEN_WITH_BMI_FORTRAN: OFF
    NGEN_WITH_BMI_C: ON
    NGEN_WITH_PYTHON: ON
    NGEN_WITH_ROUTING: ON
    NGEN_WITH_TESTS: ON
    NGEN_QUIET: OFF
Environment summary:
  Boost:
    Version: 1.83.0
    Include: /usr/include
  MPI (C):
    Version: 4.0
    Library: /usr/local/lib/libmpi.so
    Include: /usr/local/include
  MPI (CXX):
    Version: 4.0
    Library: /usr/local/lib/libmpicxx.so,/usr/local/lib/libmpi.so
    Include: /usr/local/include
  NetCDF:
    Version: 4.9.2
    Library: /usr/lib/libnetcdf.so
    Library (CXX): /usr/lib/libnetcdf_c++4.so
    Include: /usr/include
    Parallel: FALSE
  SQLite:
    Version: 3.44.0
    Library: /usr/lib/libsqlite3.so
    Include: /usr/include
  UDUNITS2:
    Library: /usr/lib/libudunits2.so
    Include: /usr/include
  Python:
    Version: 3.11.5
    Virtual Env: <none>
    Executable: /usr/bin/python3.11
    Interpreter Type: Python
    Site Library: /usr/lib/python3.11/site-packages
    Include: /usr/include/python3.11
    Runtime Library: /usr/lib
    NumPy Version: 1.26.1
    NumPy Include: /usr/lib/python3.11/site-packages/numpy/core/include
    pybind11 Version: 
    pybind11 Include: /path/to/ngen/extern/pybind11/include
Runtime configuration summary:
  MPI:
    Processors: 1
  Python:
    Version: 3.11.5 (main, Sep  2 2023, 14:16:33) [GCC 13.2.1 20230801]
    Virtual Env: <none>
    Executable: /usr/bin/python3
    Site Library: /usr/lib/python3.11/site-packages
    Include: /usr/include/python3.11
    Runtime Library: /usr/lib/python3.11
    NumPy Version: 1.26.1
    NumPy Include: /usr/lib/python3.11/site-packages/numpy/core/include

Additions

  • Build-time configured namespace ngen::exec_info that has constexpr information for version, flags, configure-time build summary, and a runtime summary function.

Changes

  • Modifies the root CMakeLists.txt to capture the output of the build summary.
  • Modifies the root CMakeLists.txt to configure the header at the end of the file, rather than after project definition.
  • Modifies FindNetcdf.cmake to parse version information.
  • Adds #include <list> to include/core/nexus/HY_PointHydroNexusRemote.hpp as this gave a compilation issue with clang 16.
  • Modifies ngen::main() to support calling ngen --info without running a workflow.

Testing

Manually tested output of ngen info using GCC 13, clang 16, and IntelLLVM.

Notes/TODO

  • Getting information about t-route when NGEN_WITH_ROUTING=ON would be useful, however, it's a bit tricky since t-route does not version its python package, and since it defaults to an editable install. May need a bit more thinking about how this would be implemented, i.e. hash all package files to get a combined "package hash"?

  • A follow-on PR organizing the main function is probably needed, I think we should begin taking a look at how to better organize our CLI component, e.g. use GNU getopt?

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

@program-- program-- added enhancement New feature or request build Issues related to CMake and building ngen labels Nov 20, 2023
@program-- program-- self-assigned this Nov 20, 2023
src/NGen.cpp Outdated Show resolved Hide resolved
src/NGen.cpp Show resolved Hide resolved
include/NGenConfig.h.in Outdated Show resolved Hide resolved
src/NGen.cpp Outdated Show resolved Hide resolved
src/NGen.cpp Outdated Show resolved Hide resolved
@PhilMiller
Copy link
Contributor

Other than my comment on MPI_Init, I'm happy with merging this

src/NGen.cpp Outdated Show resolved Hide resolved
src/NGen.cpp Outdated Show resolved Hide resolved
@PhilMiller PhilMiller merged commit f57fec0 into NOAA-OWP:master Nov 21, 2023
16 of 19 checks passed
@program-- program-- deleted the jsm-debug-info branch February 12, 2024 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues related to CMake and building ngen enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants