src/components/rocm/linux-rocm.c
/*
 * Disable and destroy the ROCM eventGroup
 */
Disable and destroy the ROCM eventGroup
Disable and destroy the ROCM eventGroup
static int _rocm_cleanup_eventset(hwd_control_state_t * ctrl)
{
    ROCMDBG("Entering _rocm_cleanup_eventset\n");
    (void) ctrl;
    _rocm_control_t *gctrl = global__rocm_control;
    uint32_t i, cc;
    for(cc = 0; cc < gctrl->countOfActiveContexts; cc++) {
        int eventDeviceNum = gctrl->arrayOfActiveContexts[cc]->deviceNum;
        (void) eventDeviceNum;                                          
        Context eventCtx = gctrl->arrayOfActiveContexts[cc]->ctx;
        ROCMDBG("Destroy device %d ctx %p \n", eventDeviceNum, eventCtx);
        ROCP_CALL_CK(rocprofiler_close, (eventCtx), return (PAPI_EMISC));
        papi_free( gctrl->arrayOfActiveContexts[cc] );
    }
    if (global__ctx_properties.queue != NULL) {
      ROCM_CALL_CK(hsa_queue_destroy, (global__ctx_properties.queue), return (PAPI_EMISC));
      global__ctx_properties.queue = NULL;
    }
    gctrl->countOfActiveContexts = 0;
    gctrl->activeEventCount = 0;
    _rocm_context_t *gctxt = global__rocm_context;
    for (i=0; i<maxEventSize; i++) {
            gctxt->availEventIsBeingMeasuredInEventset[i] = 0;
    }
    return (PAPI_OK);
}
static int _rocm_cleanup_eventset ( hwd_control_state_t * ctrl ) { ROCMDBG ( " \n " ) ; ( void ) ctrl ; _rocm_control_t * gctrl = global__rocm_control ; uint32_t i , cc ; for ( cc = 0 ; cc < gctrl -> countOfActiveContexts ; cc ++ ) { int eventDeviceNum = gctrl -> arrayOfActiveContexts [ cc ] -> deviceNum ; ( void ) eventDeviceNum ; Context eventCtx = gctrl -> arrayOfActiveContexts [ cc ] -> ctx ; ROCMDBG ( " \n " , eventDeviceNum , eventCtx ) ; ROCP_CALL_CK ( rocprofiler_close , ( eventCtx ) , return ( PAPI_EMISC ) ) ; papi_free ( gctrl -> arrayOfActiveContexts [ cc ] ) ; } if ( global__ctx_properties . queue != NULL ) { ROCM_CALL_CK ( hsa_queue_destroy , ( global__ctx_properties . queue ) , return ( PAPI_EMISC ) ) ; global__ctx_properties . queue = NULL ; } gctrl -> countOfActiveContexts = 0 ; gctrl -> activeEventCount = 0 ; _rocm_context_t * gctxt = global__rocm_context ; for ( i = 0 ; i < maxEventSize ; i ++ ) { gctxt -> availEventIsBeingMeasuredInEventset [ i ] = 0 ; } return ( PAPI_OK ) ; }
Disable and destroy the ROCM eventGroup
Disable and destroy the ROCM eventGroup
//  fprintf(stderr, "%s:%i _rocm_cleanup_eventset called.\n", __FILE__, __LINE__); // Suppress 'not used' warning when not debug. //      fprintf(stderr, "%s:%i About to call rocprofiler_close.\n", __FILE__, __LINE__); //      fprintf(stderr, "%s:%i Returned from call to rocprofiler_close, papi_free ptr=%p.\n", __FILE__, __LINE__, gctrl->arrayOfActiveContexts[cc] ); //      fprintf(stderr, "%s:%i Returned from call to papi_free.\n", __FILE__, __LINE__); /* Record that there are no active contexts or events */ //  fprintf(stderr, "%s:%i Checkpoint, maxEventSize=%i.\n", __FILE__, __LINE__, maxEventSize); /* Clear all indicators of event being measured. */ //  fprintf(stderr, "%s:%i Returning from _rocm_cleanup_eventset.\n", __FILE__, __LINE__);