Skip to content

papi fortran: Add support for papif_get_component_index#591

Open
Treece-Burgess wants to merge 1 commit into
icl-utk-edu:masterfrom
Treece-Burgess:04-17-2026-fortran-interface-cidx
Open

papi fortran: Add support for papif_get_component_index#591
Treece-Burgess wants to merge 1 commit into
icl-utk-edu:masterfrom
Treece-Burgess:04-17-2026-fortran-interface-cidx

Conversation

@Treece-Burgess

Copy link
Copy Markdown
Contributor

Pull Request Description

This PR adds support for PAPI_get_component_index in the PAPI Fortran interface.

Testing

Testing was done on Picard at Oregon (OS: RHEL 8.10 , CPU: Intel Xeon Gold 6430).

I modified ftests/eventname.F, to be as follows:

#include "fpapi.h"

      program component_index
      INTEGER retval, cidx

      retval = PAPI_VER_CURRENT
      call PAPIf_library_init( retval )
      if (retval.NE.PAPI_VER_CURRENT) then
          print *, "Call to PAPIf_library_init failed."
          call exit(1)
      end if

      call PAPIf_get_component_index( "sysdetect", cidx )
      if (cidx.LT.0) then
          print *, "Call to PAPIf_get_component_index failed."
          call exit(1)
      end if
      write (*, 1) cidx
  1   format ("Call 1: The sysdetect component index is: ", Z10)

      call papif_get_component_index( "sysdetect", cidx )
      if (cidx.LT.0) then
          print *, "Call to papif_get_component_index failed."
          call exit(1)
      end if 
      write (*, 2) cidx
  2   format ("Call 2: The sysdetect component index is: ", Z10)

      end 

As I am on Linux, I always enter the if defined(_FORTRAN_STRLEN_AT_END) block of code. Therefore, to test the else block I changed if defined(_FORTRAN_STRLEN_AT_END) to if 0. You then will need to use iso_c_binding and null terminate the string. Otherwise, junk will be placed at the end of the string.

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 requested a review from dbarry9 April 17, 2026 17:27
@Treece-Burgess Treece-Burgess added status-ready-for-review PR is ready to be reviewed type-maintenance Update code to keep it compatible, secure, modern. labels Apr 17, 2026
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-maintenance Update code to keep it compatible, secure, modern.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant