src/components/rocm/linux-rocm.c
/* Setup a counter control state.
 *   In general a control state holds the hardware info for an
 *   EventSet.
 */
Setup a counter control state.
In general a control state holds the hardware info for an
EventSet.
Setup a counter control state . In general a control state holds the hardware info for an EventSet .
static int _rocm_init_control_state(hwd_control_state_t * ctrl)
{
    ROCMDBG("Entering _rocm_init_control_state\n");
    (void) ctrl;
    _rocm_context_t *gctxt = global__rocm_context;
    CHECK_PRINT_EVAL((gctxt == NULL), "Error: The PAPI ROCM component needs to be initialized first", return (PAPI_ENOINIT));
    if(global__rocm_context->availEventSize <= 0) {
        strncpy(_rocm_vector.cmp_info.disabled_reason, "ERROR ROCM: No events exist", PAPI_MAX_STR_LEN);
        return (PAPI_EMISC);
    }
    if(global__rocm_control == NULL) {
        global__rocm_control = (_rocm_control_t *) papi_calloc(1, sizeof(_rocm_control_t));
        global__rocm_control->countOfActiveContexts = 0;
        global__rocm_control->activeEventCount = 0;
    }
    return PAPI_OK;
}
static int _rocm_init_control_state ( hwd_control_state_t * ctrl ) { ROCMDBG ( " \n " ) ; ( void ) ctrl ; _rocm_context_t * gctxt = global__rocm_context ; CHECK_PRINT_EVAL ( ( gctxt == NULL ) , " " , return ( PAPI_ENOINIT ) ) ; if ( global__rocm_context -> availEventSize <= 0 ) { strncpy ( _rocm_vector . cmp_info . disabled_reason , " " , PAPI_MAX_STR_LEN ) ; return ( PAPI_EMISC ) ; } if ( global__rocm_control == NULL ) { global__rocm_control = ( _rocm_control_t * ) papi_calloc ( 1 , sizeof ( _rocm_control_t ) ) ; global__rocm_control -> countOfActiveContexts = 0 ; global__rocm_control -> activeEventCount = 0 ; } return PAPI_OK ; }
Setup a counter control state.
Setup a counter control state .
/* If no events were found during the initial component initialization, return error */ /* If it does not exist, create the global structure to hold ROCM contexts and active events */