diff --git a/tool/ompt_callbacks.cpp b/tool/ompt_callbacks.cpp index 23a560e577b9ce1aca3711428507ae083c37f460..fadcd144ce7bc0e0ac686141664ad070da4a9d19 100644 --- a/tool/ompt_callbacks.cpp +++ b/tool/ompt_callbacks.cpp @@ -261,7 +261,6 @@ void ompt_callback_parallel_begin_action ( requested_parallelism, codeptr_ra, parallel_data->value ); -#if 0 /* TODO here: the key is the way several instances of the same parallel region are collapsed to compute statistics. @@ -299,36 +298,6 @@ void ompt_callback_parallel_begin_action ( parallel_data->value ); ++koti->tstack.top; -#endif -} - -void -implicit_task_end( - ompt_data_t *parallel_data, - ompt_data_t *task_data) -{ - uint64_t thread_id = ompt_get_thread_data()->value; - /* But because the end of implicit task is not related to on_ompt_event_parallel_end. - */ - printf("%" PRIu64 ": ompt_event_implicit_task_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 "\n", thread_id, parallel_data->value, task_data->value); - /* thread 0 ends the parallel region - But because the end of implicit task is not related to - the end of the parallel region, we define here the end of implicit task. - */ - kaapi_ompt_thread_info_t* koti = &__kaapi_oth_info[thread_id]; - int idxtop = --koti->pstack.top; - //kaapi_assert( idxtop == 0 ); - - /* reset that accumulated into */ - memset( koti->pstack.stack[idxtop].accum, 0, sizeof(koti->pstack.stack[idxtop].accum)); - kaapi_tracelib_task_end( - koti->kproc, - koti->pstack.stack[idxtop].task, - 0, 0, - koti->pstack.stack[idxtop].fdescr, - koti->pstack.t0, - koti->pstack.stack[idxtop].accum - ); } void @@ -341,8 +310,6 @@ ompt_callback_parallel_end_action( uint64_t thread_id = ompt_get_thread_data()->value; /* end implicit task here */ printf("%" PRIu64 ": on_ompt_event_parallel_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 "\n", thread_id, parallel_data->value, encountering_task_data->value); -#if 0 - implicit_task_end(parallel_data, encountering_task_data); /* end of the parallel region */ kaapi_ompt_thread_info_t* koti = &__kaapi_oth_info[thread_id]; int idxtop = --koti->tstack.top; @@ -352,7 +319,6 @@ ompt_callback_parallel_end_action( parallel_data->value ); kaapi_tracelib_team_fini( koti->kproc, koti->tstack.stack[idxtop] ); -#endif } @@ -383,7 +349,6 @@ ompt_callback_task_schedule_action( uint64_t prior_task_id = prior_task_data->value; // We are ending a task printf("%" PRIu64 ": ompt_event_task_end: task_id=%" PRIu64 "\n", thread_id, prior_task_id ); -#if 0 /* thread 0 ends the parallel region But because the end of implicit task is not related to the end of the parallel region, we define here the end of implicit task. @@ -403,7 +368,6 @@ ompt_callback_task_schedule_action( koti->pstack.stack[idxtop].accum ); kaapi_tracelib_thread_switchstate(koti->kproc); -#endif } if (next_task_data->ptr) { uint64_t new_task_id = next_task_data->value; @@ -411,13 +375,12 @@ ompt_callback_task_schedule_action( printf("%" PRIu64 ": ompt_event_task_begin: task_id=%" PRIu64 ", status=%i\n", thread_id, new_task_id, prior_task_status); /* This is code for implicit task begin. */ -#if 0 kaapi_ompt_thread_info_t* koti = &__kaapi_oth_info[thread_id]; kaapi_tracelib_thread_switchstate(koti->kproc); kaapi_descrformat_t* fdescr = kaapi_tracelib_register_fmtdescr( 0, // TODO: get codeptr_ra there - next_task_data, + next_task_data->ptr, 0, //loc "<undef>", libomp_filter_func @@ -437,7 +400,6 @@ ompt_callback_task_schedule_action( koti->pstack.top ==0 ? 0 : koti->pstack.stack[idxtop-1].accum ); ++koti->pstack.top; -#endif } } @@ -455,8 +417,47 @@ ompt_callback_implicit_task_action ( if (endpoint == ompt_scope_begin) { task_data->value = ompt_get_unique_id(); printf("%" PRIu64 ": ompt_event_implicit_task_action: begin. parallel_id=%" PRIu64 ", task_id=%" PRIu64 "\n", thread_id, parallel_data->value, task_data->value); + kaapi_ompt_thread_info_t* koti = &__kaapi_oth_info[thread_id]; + kaapi_descrformat_t* fdescr = kaapi_tracelib_register_fmtdescr( + 1, + //team->key, [> same key as the team. Not implicit task ? why ? [TG] <] + task_data->ptr, + //team->name, + "<implicit>", + 0, + 0 /* no filter: team name should be already well formed */ + ); + int idxtop = koti->pstack.top; + koti->pstack.stack[idxtop].fdescr = fdescr; + koti->pstack.stack[idxtop].task = (void*)task_data->value; + + kaapi_tracelib_task_begin( + koti->kproc, + (kaapi_task_id_t)task_data->value, + fdescr->fmtid, + 0, + 0, 0, 0, + 0, 0, + koti->pstack.t0, + 0 + ); + ++koti->pstack.top; } else if (endpoint == ompt_scope_end) { printf("%" PRIu64 ": ompt_event_implicit_task_action: end. task_id=%" PRIu64 "\n", thread_id, task_data->value); + kaapi_ompt_thread_info_t* koti = &__kaapi_oth_info[thread_id]; + int idxtop = --koti->pstack.top; + //kaapi_assert( idxtop == 0 ); + + /* reset that accumulated into */ + memset( koti->pstack.stack[idxtop].accum, 0, sizeof(koti->pstack.stack[idxtop].accum)); + kaapi_tracelib_task_end( + koti->kproc, + koti->pstack.stack[idxtop].task, + 0, 0, + koti->pstack.stack[idxtop].fdescr, + koti->pstack.t0, + koti->pstack.stack[idxtop].accum + ); } else { printf("%" PRIu64 ": ompt_event_implicit_task_action: unknown endpoint. task_id=%" PRIu64 "\n", thread_id, task_data->value); } diff --git a/ukilli/ukilli.cpp b/ukilli/ukilli.cpp index 967dc9569f8c1fdc3db548ae47cbeadd69b09d33..6b04f6b0bc5e15f74c2a10ebd7293c611910e57a 100644 --- a/ukilli/ukilli.cpp +++ b/ukilli/ukilli.cpp @@ -1756,6 +1756,11 @@ static void callback_display_rastello( break; if (KAAPI_EVENT_DATA(event,2,i8)[0] == 0) /* no explicit == forget them */ { + if (rpr == 0) { + printf("*** Implicit task without parallel region\n"); + break; + } + uint64_t addr = KAAPI_EVENT_DATA(event,0,u); rpr->container_implicit_task.insert( addr ); //printf("%" PRIu64 " Implicit Task: %p fmtid: %i\n", event->date, KAAPI_EVENT_DATA(event,0,p), (int)KAAPI_EVENT_DATA(event,1,u)); @@ -1985,6 +1990,7 @@ printf("pred[id:%i/%p] = {id:%i}/%p\n", succ->id, (void*)succ->addr, task->id, ( case KAAPI_EVT_PARALLEL : { + printf("parallel\n"); int begend = KAAPI_EVENT_DATA(event,0,i); uintptr_t parallel_id = KAAPI_EVENT_DATA(event,1,u); if (begend ==1)