Skip to content

cuda: Update SUBDBG format specifier from %lu to %u to avoid compilation warning#527

Merged
Treece-Burgess merged 1 commit intoicl-utk-edu:masterfrom
Treece-Burgess:12-29-2025-cuda-compilation-warnings
Jan 8, 2026
Merged

cuda: Update SUBDBG format specifier from %lu to %u to avoid compilation warning#527
Treece-Burgess merged 1 commit intoicl-utk-edu:masterfrom
Treece-Burgess:12-29-2025-cuda-compilation-warnings

Conversation

@Treece-Burgess
Copy link
Contributor

@Treece-Burgess Treece-Burgess commented Dec 30, 2025

Pull Request Descriptionl

When configuring PAPI as follows ./configure --prefix=$PWD/test-install --with-components="cuda" --with-debug=yes and subsequently building on Heimdall at Oregon (1 * NVIDIA GeForce RTX 5080) you will run into the below compilation warnings:

components/cuda/cupti_event_and_metric.c:1591:12: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint32_t’ {aka ‘unsigned int’} [-Wformat=]
 1591 |     SUBDBG("ENTER: event_code: %lu, modifier: %d\n", *event_code, modifier);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~
      |                                                      |
      |                                                      uint32_t {aka unsigned int}
./papi_debug.h:60:115: note: in definition of macro ‘PAPIDEBUG’
   60 | #define PAPIDEBUG(level,format, args...) { if(_papi_hwi_debug&level){DEBUGLABEL(DEBUGLEVEL(level));fprintf(stderr,format, ## args);}}
      |                                                                                                                   ^~~~~~
components/cuda/cupti_event_and_metric.c:1591:5: note: in expansion of macro ‘SUBDBG’
 1591 |     SUBDBG("ENTER: event_code: %lu, modifier: %d\n", *event_code, modifier);
      |     ^~~~~~
components/cuda/cupti_event_and_metric.c:1591:34: note: format string is defined here
 1591 |     SUBDBG("ENTER: event_code: %lu, modifier: %d\n", *event_code, modifier);
      |                                ~~^
      |                                  |
      |                                  long unsigned int
      |                                %u
+ test  != 

This PR resolves this compilation warning and closes Issue #519 by updating a format specifier from %lu to %u.

Testing

Setup

This PR was tested on Heimdall at Oregon with:

  • CPU: AMD Ryzen 9 9950X 16-Core Processor
  • GPU: 1 * NVIDIA GeForce RTX 5080
  • OS: Ubuntu 24.04.3
  • Cuda Toolkit: 12.9

Results

  • Compilation and PAPI build: ✅ (compilation warnings did not occur)
  • PAPI utilities*: ✅
  • Cuda component tests: ✅ (Note: Running runtest.sh will result in test failures as the event cuda:::dram__bytes_read:stat=sum:device=0 does not exist on Heimdall)

* - papi_component_avail, papi_native_avail, papi_command_line

Author Checklist

  • Description
    Why this PR exists. Reference all relevant information, including background, issues, test failures, etc
  • Commits
    Commits are self contained and only do one thing
    Commits have a header of the form: module: short description
    Commits have a body (whenever relevant) containing a detailed description of the addressed problem and its solution
  • Tests
    The PR needs to pass all the tests

@Treece-Burgess Treece-Burgess added component-cuda PRs and Issues related to the cuda component type-bug Issues discussing bugs or PRs fixing bugs labels Dec 30, 2025
@Treece-Burgess Treece-Burgess linked an issue Dec 30, 2025 that may be closed by this pull request
Copy link
Contributor

@dbarry9 dbarry9 left a comment

Choose a reason for hiding this comment

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

I tested these changes on a system containing the NVIDIA Blackwell architecture and using CUDA 12.9.0 and GCC 13.3.0, and the compiler warning from Issue #519 no longer occurs. The PAPI utilities (papi_avail, papi_native_avail, papi_component_avail, papi_hardware_avail, and papi_mem_info) and cuda component tests behave as expected.

@Treece-Burgess Can you rebase so that we can merge this PR?

@Treece-Burgess Treece-Burgess force-pushed the 12-29-2025-cuda-compilation-warnings branch from 47937d0 to 4103144 Compare January 8, 2026 17:17
@Treece-Burgess Treece-Burgess merged commit 044818e into icl-utk-edu:master Jan 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component-cuda PRs and Issues related to the cuda component type-bug Issues discussing bugs or PRs fixing bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue]: cuda component compiler warnings

2 participants