Skip to content

Comments

papi_hl region-based calculations#529

Open
mpatrou wants to merge 9 commits intoicl-utk-edu:masterfrom
mpatrou:papi_hl_updates
Open

papi_hl region-based calculations#529
mpatrou wants to merge 9 commits intoicl-utk-edu:masterfrom
mpatrou:papi_hl_updates

Conversation

@mpatrou
Copy link
Contributor

@mpatrou mpatrou commented Jan 6, 2026

Pull Request Description

Sibling PR (2/2) split from #525
It updates papi_hl:

  • region-based energy counter calculations: delta for energy_consumption above
  • region-based energy counter calculations: average between before and after, used in gpu_inst_power

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
Copy link
Contributor

As this PR was created from a split of PR #525, an important thread to note is the following.

@Treece-Burgess Treece-Burgess added type-feature Issues that request a new feature or PRs that add a new feature status-ready-for-review PR is ready to be reviewed labels Jan 9, 2026
@Treece-Burgess Treece-Burgess self-requested a review January 9, 2026 16:37
}

// except from nvml gpu_inst_power average
if( (strstr(requested_event_names[i], "nvml:::") != NULL) && (strstr(requested_event_names[i], "gpu_inst_power") != NULL) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: As you are wanting to calculate a region average for event type 2, should gpu_inst_power actually be gpu_memory_avg_power?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you. I included gpu_memory_avg_power for region-based average, too, for higher accuracy.

return ( retval );
}
/* get cycles for last component */
retval = PAPI_read_ts( _local_components[num_of_components - 1].EventSet, _local_components[num_of_components - 1].values, &_local_cycles );
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Why is the change to this section needed? It does not appear to me that it is behaving correctly.

For instance, if I look solely at gpu_memory_avg_power between the master branch and your branch this event remains as an instant event type. However, in the master branch I get a value of 3472328295419250878, but in your branch I get a value of 35295. If I take your branch and change this section back to how it is in master then I get a comparable value again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly. This number: 3472328295419250878 does not look like a valid number. For example gpu_memory_avg_power represents power in mW. Something like that: 18198 mW or 35295 mW, makes more sense to be reported.

Copy link
Contributor

Choose a reason for hiding this comment

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

The issue with this change is that the last component will have two reads occur for it which are:

  1. PAPI_read
  2. PAPI_read_ts

The latter will overwrite the first PAPI_read value. When a user calls PAPI_hl_region_begin, PAPI_hl_read, or PAPI_hl_region_end they would expect a single read to occur similar to if they called the low level API with PAPI_read. Therefore, this change needs to be reverted back to what it is currently in the master branch.

The reason for this extremely large value is because of the internal code introduced in PR #525 specifically the following block. The value returned is a field_value->value.ullVal; however, for a fieldId of NVML_FI_DEV_POWER_INSTANT you need to use a valueType of uiVal.

I have tested the code in PR #564 with this current PR and I have not seen an extremely large value output after 10 runs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. changes reverted! thank you!!

@mpatrou
Copy link
Contributor Author

mpatrou commented Feb 12, 2026

Hello @Treece-Burgess. Do we have any news on this?

@Treece-Burgess
Copy link
Contributor

Hello @Treece-Burgess. Do we have any news on this?

Hello @mpatrou I will do a final run through of the PR either tomorrow or this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status-ready-for-review PR is ready to be reviewed type-feature Issues that request a new feature or PRs that add a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants