src/components/rocm/linux-rocm.c
/* Triggered by PAPI_shutdown() and frees memory allocated in the ROCM component. */
Triggered by PAPI_shutdown() and frees memory allocated in the ROCM component.
Triggered by PAPI_shutdown () and frees memory allocated in the ROCM component .
static int _rocm_shutdown_component(void)
{
    ROCMDBG("Entering _rocm_shutdown_component\n");
    _rocm_control_t *gctrl = global__rocm_control;
    _rocm_context_t *gctxt = global__rocm_context;
    uint32_t cc;
    if(gctxt != NULL) {
        papi_free(gctxt->availEventIDArray);
        papi_free(gctxt->availEventDeviceNum);
        papi_free(gctxt->availEventIsBeingMeasuredInEventset);
        papi_free(gctxt->availEventDesc);
        papi_free(gctxt);
        global__rocm_context = gctxt = NULL;
    }
    if(gctrl != NULL) {
        for(cc = 0; cc < gctrl->countOfActiveContexts; cc++) {
            if(gctrl->arrayOfActiveContexts[cc] != NULL) {
                papi_free(gctrl->arrayOfActiveContexts[cc]);
            }
        }
        papi_free(gctrl);
        global__rocm_control = gctrl = NULL;
    }
    ROCM_CALL_CK(hsa_shut_down, (), return (PAPI_EMISC));
    dlclose(dl1);
    dlclose(dl2);
    return (PAPI_OK);
}
static int _rocm_shutdown_component ( void ) { ROCMDBG ( " \n " ) ; _rocm_control_t * gctrl = global__rocm_control ; _rocm_context_t * gctxt = global__rocm_context ; uint32_t cc ; if ( gctxt != NULL ) { papi_free ( gctxt -> availEventIDArray ) ; papi_free ( gctxt -> availEventDeviceNum ) ; papi_free ( gctxt -> availEventIsBeingMeasuredInEventset ) ; papi_free ( gctxt -> availEventDesc ) ; papi_free ( gctxt ) ; global__rocm_context = gctxt = NULL ; } if ( gctrl != NULL ) { for ( cc = 0 ; cc < gctrl -> countOfActiveContexts ; cc ++ ) { if ( gctrl -> arrayOfActiveContexts [ cc ] != NULL ) { papi_free ( gctrl -> arrayOfActiveContexts [ cc ] ) ; } } papi_free ( gctrl ) ; global__rocm_control = gctrl = NULL ; } ROCM_CALL_CK ( hsa_shut_down , ( ) , return ( PAPI_EMISC ) ) ; dlclose ( dl1 ) ; dlclose ( dl2 ) ; return ( PAPI_OK ) ; }
Triggered by PAPI_shutdown() and frees memory allocated in the ROCM component.
Triggered by PAPI_shutdown () and frees memory allocated in the ROCM component .
/* Free context */ /* Free control */ // Shutdown ROC runtime // DEBUG: This causes a segfault. // close the dynamic libraries needed by this component (opened in the init substrate call)