void vt_cupti_activity_finalize() { if(!vt_cuptiact_finalized && vt_cuptiact_initialized){ VT_CUPTI_LOCK(); if(!vt_cuptiact_finalized && vt_cuptiact_initialized){ vt_cupti_ctx_t *vtCtx = vt_cupti_ctxList; vt_cntl_msg(2, "[CUPTI Activity] Finalizing ... "); while(vtCtx != NULL){ /* write buffered activities, which have not been dumped yet */ vt_cuptiact_flushCtxActivities(vtCtx); /* free the context */ vt_cuptiact_destroyContext(vtCtx->activity); vtCtx->activity = NULL; /* set pointer to next context */ vtCtx = vtCtx->next; } vt_cuptiact_finalized = 1; VT_CUPTI_UNLOCK(); } } }
void vt_cupti_activity_finalize() { if(!vt_cuptiact_finalized && vt_cuptiact_initialized){ VT_CUPTI_ACT_LOCK(); if(!vt_cuptiact_finalized && vt_cuptiact_initialized){ vt_cntl_msg(2, "[CUPTI Activity] Finalizing ... "); vt_cuptiact_finalized = 1; VT_CUPTI_ACT_UNLOCK(); while(vt_cuptiact_ctxList != NULL){ vt_cuptiact_ctx_t *vtCtx = vt_cuptiact_ctxList; /* write buffered activities, which have not been dumped yet */ vt_cuptiact_flushCtxActivities(vtCtx->cuCtx); /* set pointer to next context before freeing current one */ vt_cuptiact_ctxList = vt_cuptiact_ctxList->next; /* free the context */ vt_cuptiact_destroyContext(vtCtx); } #if (defined(VT_MT) || defined (VT_HYB)) VTTHRD_LOCK_ENV(); VTThrd_deleteMutex(&VTThrdMutexCuptiAct); VTTHRD_UNLOCK_ENV(); #endif /* VT_MT || VT_HYB */ } } }