void addInterCommunicator (uintptr_t InterCommID, uintptr_t CommID1, int leader1, uintptr_t CommID2, int leader2, int ptask, int task) { unsigned u, found_pos; int found = FALSE; CommID1 = alies_comunicador (CommID1, ptask, task); CommID2 = alies_comunicador (CommID2, ptask, task); ptask--; task--; for (u = 0; u < num_InterCommunicators; ++u) { found = (InterComm_global[u].comms[0] == CommID1 && InterComm_global[u].comms[1] == CommID2) || (InterComm_global[u].comms[1] == CommID1 && InterComm_global[u].comms[0] == CommID2); if (found) { found_pos = u; break; } } if (!found) { found_pos = num_InterCommunicators; num_InterCommunicators++; InterComm_global = (InterCommInfo_t *) realloc (InterComm_global, sizeof(InterCommInfo_t)*num_InterCommunicators); ASSERT(NULL != InterComm_global, "Not enough memory for inter-communicators alias"); InterComm_global[found_pos].comms[0] = CommID1; InterComm_global[found_pos].comms[1] = CommID2; InterComm_global[found_pos].leaders[0] = leader1; InterComm_global[found_pos].leaders[1] = leader2; InterComm_global[found_pos].commid = InterCommID; InterComm_global[found_pos].alias = num_comunicadors + ID_MINIM; num_comunicadors++; } addInterCommunicatorAlias (InterCommID, InterComm_global[found_pos].alias, ptask, task); }
static int ANY_Send_Event (event_t * current, unsigned long long current_time, unsigned int cpu, unsigned int ptask, unsigned int task, unsigned int thread, FileSet_t *fset) { thread_t * thread_info = GET_THREAD_INFO(ptask, task, thread); int tipus; int isimmediate; int comunicador; UINT64 valor; double temps; UNREFERENCED_PARAMETER(cpu); if (MPI_IBSEND_EV == Get_EvEvent(current) || MPI_ISSEND_EV == Get_EvEvent(current) || MPI_IRSEND_EV == Get_EvEvent(current) || MPI_ISEND_EV == Get_EvEvent(current)) isimmediate = TRUE; else isimmediate = FALSE; temps = current_time-thread_info->Previous_Event_Time; temps /= 1000000000.0f; comunicador = alies_comunicador (Get_EvComm(current), 1, task); switch (Get_EvValue(current)) { case EVT_BEGIN: Dimemas_CPU_Burst (fset->output_file, task-1, thread-1, temps); break; case EVT_END: if (Get_EvTarget(current) != MPI_PROC_NULL) { #ifdef CPUZERO Dimemas_CPU_Burst (fset->output_file, task-1, thread-1, 0); #endif if (!isimmediate) Dimemas_NX_BlockingSend (fset->output_file, task-1, thread-1, Get_EvTarget(current), comunicador, Get_EvSize(current), Get_EvTag(current)); else Dimemas_NX_ImmediateSend (fset->output_file, task-1, thread-1, Get_EvTarget(current), comunicador, Get_EvSize(current), Get_EvTag(current)); } #ifdef CPUZERO Dimemas_CPU_Burst (fset->output_file, task-1, thread-1, 0); #endif break; } Translate_MPI_MPIT2PRV (Get_EvEvent(current), Get_EvValue(current), &tipus, &valor); Dimemas_User_Event (fset->output_file, task-1, thread-1, tipus, valor); return 0; }
/****************************************************************************** *** PersistentRequest_Event ******************************************************************************/ static int PersistentRequest_Event (event_t * current, unsigned long long current_time, unsigned int cpu, unsigned int ptask, unsigned int task, unsigned int thread, FileSet_t *fset) { int comunicador; UNREFERENCED_PARAMETER(current_time); UNREFERENCED_PARAMETER(cpu); UNREFERENCED_PARAMETER(ptask); comunicador = alies_comunicador (Get_EvComm(current), 1, task); if (Get_EvTarget(current) == MPI_PROC_NULL) return 0; #ifdef CPUZERO Dimemas_CPU_Burst(fset->output_file, task-1, thread-1, 0); #endif switch (Get_EvValue(current)) { case MPI_IRECV_EV: Dimemas_NX_Irecv (fset->output_file, task-1, thread-1, Get_EvTarget(current), comunicador, Get_EvSize(current), Get_EvTag(current) ); break; case MPI_ISEND_EV: case MPI_IBSEND_EV: case MPI_IRSEND_EV: case MPI_ISSEND_EV: if (MPI_PROC_NULL != Get_EvTarget(current)) { #ifdef CPUZERO Dimemas_CPU_Burst(fset->output_file, task-1, thread-1, 0); #endif Dimemas_NX_ImmediateSend(fset->output_file, task-1, thread-1, Get_EvTarget(current), comunicador, Get_EvSize(current), Get_EvTag(current)); } break; default: break; } return 0; }
/****************************************************************************** *** Irecved_Event ******************************************************************************/ static int Irecved_Event (event_t * current, unsigned long long current_time, unsigned int cpu, unsigned int ptask, unsigned int task, unsigned int thread, FileSet_t *fset) { int comunicador; UNREFERENCED_PARAMETER(cpu); UNREFERENCED_PARAMETER(ptask); UNREFERENCED_PARAMETER(current_time); comunicador = alies_comunicador (Get_EvComm(current), 1, task); if (MPI_PROC_NULL != Get_EvTarget(current)) { #ifdef CPUZERO Dimemas_CPU_Burst (fset->output_file, task-1, thread-1, 0); #endif Dimemas_NX_Wait (fset->output_file, task-1, thread-1, Get_EvTarget(current), comunicador, Get_EvSize(current), Get_EvTag(current)); } return 0; }
static int paraver_build_multi_event (struct fdz_fitxer fdz, paraver_rec_t ** current, PRVFileSet_t * fset, unsigned long long *num_events) { #define MAX_EVENT_COUNT_IN_MULTI_EVENT 1024 unsigned int events[MAX_EVENT_COUNT_IN_MULTI_EVENT]; UINT64 values[MAX_EVENT_COUNT_IN_MULTI_EVENT]; int prev_cpu, prev_ptask, prev_task, prev_thread; unsigned long long prev_time; paraver_rec_t *cur; UINT64 CallerAddresses[MAX_CALLERS]; unsigned nevents = 0; // Here we store the caller addresses for a reference to a dynamic mem object // Set to 0 initially memset (CallerAddresses, 0, sizeof(CallerAddresses)); cur = *current; prev_cpu = cur->cpu; prev_ptask = cur->ptask; prev_task = cur->task; prev_thread = cur->thread; prev_time = cur->time; while (cur != NULL) { /* Merge multiple events if they are in the same cpu, task, thread and time */ if (prev_cpu == cur->cpu && prev_ptask == cur->ptask && prev_task == cur->task && prev_thread == cur->thread && prev_time == cur->time && cur->type == 2 && nevents < MAX_EVENT_COUNT_IN_MULTI_EVENT) { /* Copy the value by default... we'll change it if needed */ values[nevents] = cur->value; events[nevents] = cur->event; #if defined(DEBUG) fprintf (stderr, "mpi2prv: paraver_build_multi_event %d:%d:%d <%d,%llu> @ %llu\n", prev_ptask, prev_task, prev_thread, events[nevents], values[nevents], prev_time); #endif if (cur->event == MPI_GLOBAL_OP_COMM) values[nevents] = (UINT64)alies_comunicador ((int) cur->value, cur->ptask, cur->task); #if defined(HAVE_BFD) else { if (cur->event == USRFUNC_EV || cur->event == USRFUNC_LINE_EV || (cur->event >= CALLER_EV && cur->event < CALLER_EV + MAX_CALLERS) || (cur->event >= CALLER_LINE_EV && cur->event < CALLER_LINE_EV + MAX_CALLERS) || (cur->event >= SAMPLING_EV && cur->event < SAMPLING_EV + MAX_CALLERS) || (cur->event >= SAMPLING_LINE_EV && cur->event < SAMPLING_LINE_EV + MAX_CALLERS) || cur->event == OMPFUNC_EV || cur->event == OMPFUNC_LINE_EV || cur->event == TASKFUNC_EV || cur->event == TASKFUNC_LINE_EV || cur->event == TASKFUNC_INST_EV || cur->event == TASKFUNC_INST_LINE_EV || cur->event == PTHREAD_FUNC_EV || cur->event == PTHREAD_FUNC_LINE_EV || cur->event == CUDAFUNC_EV || cur->event == CUDAFUNC_LINE_EV) { values[nevents] = paraver_translate_bfd_event (cur->ptask, cur->task, cur->event, cur->value); } if (cur->event == FILE_NAME_EV) { /* Unify the file identifiers. Each task stored local identifiers for the open files, * and after the first merge phase, we shared all the ids and we change them now * for a global id, so that each file pathname has an unique id */ values[nevents] = Unify_File_Id(cur->ptask, cur->task, cur->value); } if (cur->event >= SAMPLING_ADDRESS_ALLOCATED_OBJECT_CALLER_EV && cur->event < SAMPLING_ADDRESS_ALLOCATED_OBJECT_CALLER_EV+MAX_CALLERS) { CallerAddresses[cur->event-SAMPLING_ADDRESS_ALLOCATED_OBJECT_CALLER_EV] = cur->value; } if (cur->event == SAMPLING_ADDRESS_ALLOCATED_OBJECT_EV) { values[nevents] = Address2Info_Translate_MemReference (cur->ptask, cur->task, cur->value, MEM_REFERENCE_DYNAMIC, CallerAddresses); // Set to 0 again after emitting the information memset (CallerAddresses, 0, sizeof(CallerAddresses)); } else if (cur->event == SAMPLING_ADDRESS_STATIC_OBJECT_EV) { values[nevents] = Address2Info_Translate_MemReference (cur->ptask, cur->task, cur->value, MEM_REFERENCE_STATIC, NULL); events[nevents] = SAMPLING_ADDRESS_ALLOCATED_OBJECT_EV; // Set to 0 again after emitting the information memset (CallerAddresses, 0, sizeof(CallerAddresses)); } if (Extrae_Vector_Count (&RegisteredCodeLocationTypes) > 0) { unsigned u; unsigned umax = Extrae_Vector_Count (&RegisteredCodeLocationTypes); for (u = 0; u < umax; u++) { Extrae_Addr2Type_t *element = Extrae_Vector_Get (&RegisteredCodeLocationTypes, u); if (element->FunctionType == cur->event || element->LineType == cur->event) values[nevents] = paraver_translate_bfd_event (cur->ptask, cur->task, cur->event, cur->value); } } if (get_option_merge_EmitLibraryEvents()) { if (cur->event == USRFUNC_EV || (cur->event >= CALLER_EV && cur->event < CALLER_EV + MAX_CALLERS) || (cur->event >= SAMPLING_EV && cur->event < SAMPLING_EV + MAX_CALLERS) || cur->event == OMPFUNC_EV || cur->event == TASKFUNC_INST_EV || cur->event == PTHREAD_FUNC_EV || cur->event == CUDAFUNC_EV) { if (cur->value == UNRESOLVED_ID+1 || cur->value == NOT_FOUND_ID+1) { nevents++; events[nevents] = LIBRARY_EV; values[nevents] = Address2Info_GetLibraryID (cur->ptask, cur->task, cur->value); } } else { if (Extrae_Vector_Count (&RegisteredCodeLocationTypes) > 0) { unsigned u; unsigned umax = Extrae_Vector_Count (&RegisteredCodeLocationTypes); for (u = 0; u < umax; u++) { Extrae_Addr2Type_t *element = Extrae_Vector_Get (&RegisteredCodeLocationTypes, u); if (element->FunctionType == cur->event || element->LineType == cur->event) if (cur->value == UNRESOLVED_ID+1 || cur->value == NOT_FOUND_ID+1) { nevents++; events[nevents] = LIBRARY_EV; values[nevents] = Address2Info_GetLibraryID (cur->ptask, cur->task, cur->value); } } } } } } #endif /* These events don't go into final tracefile */ if (!(cur->event >= SAMPLING_ADDRESS_ALLOCATED_OBJECT_CALLER_EV && cur->event < SAMPLING_ADDRESS_ALLOCATED_OBJECT_CALLER_EV+MAX_CALLERS)) nevents++; } else break; /* Keep searching ... */ cur = GetNextParaver_Rec (fset); } paraver_multi_event (fdz, prev_cpu, prev_ptask, prev_task, prev_thread, prev_time, nevents, events, values); *current = cur; if (num_events != NULL) *num_events = nevents; return 0; #undef MAX_EVENT_COUNT_IN_MULTI_EVENT }
/****************************************************************************** *** Sendrecv_Event ******************************************************************************/ static int SendRecv_Event (event_t * current, unsigned long long current_time, unsigned int cpu, unsigned int ptask, unsigned int task, unsigned int thread, FileSet_t *fset) { static unsigned int receiver, send_tag; static int send_size; thread_t * thread_info = GET_THREAD_INFO(ptask, task, thread); UINT64 valor; unsigned int sender = 0; unsigned int receive_tag = 0; unsigned int receive_size = 0; int tipus; int comunicador; double temps; UNREFERENCED_PARAMETER(cpu); temps = current_time-thread_info->Previous_Event_Time; temps /= 1000000000.0f; comunicador = alies_comunicador (Get_EvComm(current), 1, task); switch( Get_EvValue(current) ) { case EVT_BEGIN: Dimemas_CPU_Burst(fset->output_file, task-1, thread-1, temps); receiver= Get_EvTarget(current); send_tag= Get_EvTag(current); send_size= Get_EvSize(current); break; case EVT_END: #ifdef CPUZERO MPTRACE_ERROR(Dimemas_CPU_Burst(fset->output_file, task-1, thread-1, 0)); #endif if (Get_EvTarget( current ) != MPI_PROC_NULL) { sender= Get_EvTarget(current); receive_tag= Get_EvTag(current); receive_size= Get_EvSize(current); #ifdef CPUZERO Dimemas_CPU_Burst(fset->output_file, task-1, thread-1, 0); #endif Dimemas_NX_Irecv (fset->output_file, task-1, thread-1, sender, comunicador, receive_size, receive_tag); } if (receiver != MPI_PROC_NULL) { #ifdef CPUZERO Dimemas_CPU_Burst(fset->output_file, task-1, thread-1, 0); #endif Dimemas_NX_BlockingSend (fset->output_file, task-1, thread-1, receiver, Get_EvComm(current), send_size, send_tag); } if (Get_EvTarget( current ) != MPI_PROC_NULL) { #ifdef CPUZERO Dimemas_CPU_Burst(fset->output_file, task-1, thread-1, 0); #endif Dimemas_NX_Wait (fset->output_file, task-1, thread-1, sender, comunicador, receive_size, receive_tag); } #ifdef CPUZERO Dimemas_CPU_Burst(fset->output_file, task-1, thread-1, 0); #endif break; } Translate_MPI_MPIT2PRV (Get_EvEvent(current), Get_EvValue(current), &tipus, &valor); Dimemas_User_Event (fset->output_file, task-1, thread-1, tipus, valor); return 0; }
static int Get_GlobalOP_CommID (event_t *current, int task) { return alies_comunicador (Get_EvComm(current), 1, task); }