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

Print CRC64 code each time a pointer is requested #42

Merged
merged 6 commits into from
May 30, 2024

Conversation

pmarguinaud
Copy link
Collaborator

@pmarguinaud pmarguinaud commented May 27, 2024

This PR adds the following capability : each time a field is accessed with GET accessors functions, Field API prints a checksum. In addition, a backtrace of where the field was accessed from can be printed.

These two features are controlled with the following global variables (field_defaults_module.F90) :

  • GET_DEBUG_PRINT_CRC
  • GET_DEBUG_PRINT_LOCATION

Addresses are printed in hexadecimal, but can be converted to real code locations using addr2line.

An example of listing (taken from an ARPEGE run), after post-processing with addr2line :

F29B6FA62488FFFF FIELD_3RD RDONLY    DEVICE     cpg_gp_parallel.F90:1661 cpg_parallel.F90:358 cpg_drv.F90:370 gp_model.F90:379
F26961A07CFFFFFF FIELD_3RD RDONLY    DEVICE     cpg_gp_parallel.F90:1662 cpg_parallel.F90:358 cpg_drv.F90:370 gp_model.F90:379
B00D273ECD847BE1 FIELD_3RD RDONLY    DEVICE     cpg_gp_parallel.F90:1663 cpg_parallel.F90:358 cpg_drv.F90:370 gp_model.F90:379
128A617186047897 FIELD_3RD RDONLY    DEVICE     cpg_gp_parallel.F90:1664 cpg_parallel.F90:358 cpg_drv.F90:370 gp_model.F90:379

Furthermore, this PR enables the calculation of CRC64 checksums without altering the field status (ie host/device freshness).

Please note that the backtrace feature (field_backtrace.c) is available only on Linux platforms; some help is required here to detect (with cmake) whether we are running on Linux.

You can test CRC/backtrace printing with the test_gang case :

$ export GET_DEBUG_PRINT_CRC=1
$ export GET_DEBUG_PRINT_LOCATION=1
$ ./tests/test_gang.x

@pmarguinaud pmarguinaud requested a review from awnawab May 27, 2024 05:48
Copy link
Collaborator

@awnawab awnawab left a comment

Choose a reason for hiding this comment

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

Hi @pmarguinaud. Many many (!) thanks for adding these very powerful debugging utilities 🙏 I think your checks for execinfo.h are sufficient for checking the architecture. This file also exists on macos and indeed these debugging features also work there.

@awnawab awnawab merged commit 0f60b5b into ecmwf-ifs:main May 30, 2024
4 checks passed
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 this pull request may close these issues.

2 participants