20 #ifndef DOXYGEN_SHOULD_SKIP_THIS
30 #include <sys/types.h>
45 #if defined(PASTIX_BLEND_GENTRACE)
70 blendAddVar(
int clustnum, varPrec time,
const char* type,
71 const char* cont, varPrec val )
73 if ( clustnum == 0 ) {
74 addVar( time, type, cont, val );
99 blendSubVar(
int clustnum, varPrec time,
const char* type,
100 const char* cont, varPrec val )
102 if ( clustnum == 0 ) {
103 subVar( time, type, cont, val );
109 #ifndef DOXYGEN_SHOULD_SKIP_THIS
110 #define blendAddVar( clustnum, time, type, cont, val ) \
113 #define blendSubVar( clustnum, time, type, cont, val ) \
162 double startup, bandwidth, addcost;
167 if( clustsrc == clustdst ) {
171 assert( (clustsrc >= 0) && (clustdst >= 0) );
176 assert( (N > 0) && (M > 0) );
180 *send = (startup + bandwidth * (M * N *
sizeof(double) + FTGT_MAXINFO *
sizeof(
pastix_int_t)));
181 addcost = PERF_GEAM( M, N );
182 *add = addcost > 0. ? addcost : 0.0;
222 for(i=0; i<symbptr->
cblknbr; i++, curcblk++)
228 for(j=fbloknum; j<lbloknum; j++)
233 for(k=j; k<lbloknum; k++)
236 if(facebloknum >= 0) {
238 firstbloknum = facebloknum;
249 for(i=0;i<simuctrl->
tasknbr;i++)
255 for(j=fbloknum; j<lbloknum; j++) {
303 for(i=0; i<symbptr->
cblknbr; i++, curcblk++)
309 for(j=fbloknum; j<lbloknum; j++)
311 fprintf(fd1,
"%ld %ld\n", (
long)j, (
long)simuctrl->
bloktab[j].
ctrbcnt);
313 #if defined(PASTIX_SYMBOL_DUMP_SYMBMTX)
314 fprintf(fd2,
"%ld %ld %ld\n", (
long)i, (
long)simuctrl->
cblktab[i].
ctrbcnt, (
long)curcblk->split_cblk);
316 fprintf(fd2,
"%ld %ld\n", (
long)i, (
long)simuctrl->
cblktab[i].
ctrbcnt);
356 double ready_date = 0.0;
359 #if defined(PASTIX_BLEND_COSTLEVEL)
364 assert( tasknum != -1 );
375 procnum <= cblkcand->lcandnum; procnum++, sproc++)
391 procnum <= cblkcand->lcandnum; procnum++, sproc++)
443 double earlytimeready = PASTIX_INT_MAX;
444 double earlyproctimer = PASTIX_INT_MAX;
499 timeready = MAX( timeready,
timerVal( &(task->
time) ) );
505 if((timeready == earlytimeready) && (
timerVal(TIMER(p)) < earlyproctimer))
508 earlyproctimer =
timerVal(TIMER(p));
510 earlytimeready = timeready;
513 if(timeready < earlytimeready)
517 earlytimeready = timeready;
522 #if defined(PASTIX_BLEND_GENTRACE)
523 if ( (earlytask != -1) && (ctrl->
clustnum == 0) )
530 p <= cblkcand->lcandnum; p++, sproc++)
535 blendSubVar( ctrl->
clustnum, earlytimeready,
"VR_AP",
"Appli", 1 );
551 *procnumptr = procnum;
589 double lftgttime = 0;
590 double sftgttime = 0;
612 for(i=simuctrl->
bloktab[bloknum].
ftgtnum; i<simuctrl->bloktab[bloknum+1].ftgtnum; i++)
615 clustdst = INDEX2CLUST(i, bloknum);
637 #if defined(PASTIX_DEBUG_BLEND)
639 pastix_print_error(
"ftgt %ld costsend %f", (
long)i, simuctrl->
ftgttab[i].
costsend );
642 pastix_print_error(
"ftgt %ld costadd %f", (
long)i, simuctrl->
ftgttab[i].
costadd );
670 for(i=simuctrl->
bloktab[bloknum].
ftgtnum; i<simuctrl->bloktab[bloknum+1].ftgtnum;i++)
795 procnum = simuctrl->
ownetab[cblknum];
797 sproc = &(simuctrl->
proctab[procnum]);
804 (procnum <= ctrl->candtab[cblknum].lcandnum) );
809 for(i=fbloknum+1; i<lbloknum; i++)
825 for(j=i; j<lbloknum; j++)
831 if( facingblok >= 0 ) {
844 firstfacingblok = facingblok;
850 assert( facingtask < simuctrl->tasknbr );
854 ftgtnum = CLUST2INDEX(facingblok, clustnum);
858 ftgtnum = CLUST2INDEX( facingdiagblok, clustnum );
919 sproc = &(simuctrl->
proctab[procnum]);
942 #
if defined(PASTIX_BLEND_COSTLEVEL)
996 #if defined(PASTIX_BLEND_GENTRACE)
997 static volatile pastix_atomic_lock_t trace_lock = PASTIX_ATOMIC_UNLOCKED;
998 char **procnames = NULL;
1002 pastix_atomic_lock( &trace_lock );
1003 char *tracename = NULL;
1006 if ( ctrl->
dirname == NULL ) {
1007 tracename = strdup(
"blend" );
1010 rc = asprintf( &tracename,
"%s/blend", ctrl->
dirname );
1013 setTraceType (PAJE);
1014 initTrace (tracename, 0, GTG_FLAG_NONE);
1015 pajeEventDefAddParam( GTG_PAJE_EVTDEF_SetState,
"TaskId", GTG_PAJE_FIELDTYPE_Int );
1018 addContType (
"CT_Appli",
"0",
"Application" );
1019 addContType (
"CT_P",
"CT_Appli",
"Process" );
1020 addContType (
"CT_T",
"CT_P",
"Thread" );
1021 addStateType(
"ST_TS",
"CT_T",
"Thread State");
1022 addVarType (
"VR_TS",
"Ready tasks per thread",
"CT_T" );
1023 addVarType (
"VR_AP",
"Ready tasks",
"CT_Appli" );
1025 addLinkType (
"LT_TL",
"Split Event Link",
"CT_P",
"CT_T",
"CT_T");
1028 addContainer (0.00000,
"Appli",
"CT_Appli",
"0",
"PaStiX Blend Simulation",
"");
1031 addEntityValue (
"Wait",
"ST_TS",
"Waiting", GTG_LIGHTGREY);
1032 addEntityValue (
"Comp",
"ST_TS",
"Computing", GTG_RED);
1034 setVar( 0.0,
"VR_AP",
"Appli", 0 );
1039 procnames = (
char**) malloc ( ctrl->
total_nbthrds *
sizeof(
char*) );
1045 rc = asprintf( &clustname,
"Process %02d", (
int)i); assert(rc!=-1);
1046 rc = asprintf( &clustalias,
"P%d", (
int)i); assert(rc!=-1);
1047 addContainer (0.00000, clustalias,
"CT_P",
"Appli", clustname,
"");
1053 rc = asprintf( &procname,
"Thread %02d", (
int)pr); assert(rc!=-1);
1054 rc = asprintf( &procalias,
"T%d", (
int)pr); assert(rc!=-1);
1055 addContainer (0.00000, procalias,
"CT_T", clustname, procname,
"");
1059 procnames[pr] = procalias;
1063 free(clustname); free(clustalias);
1079 for(i=0;i<symbptr->
cblknbr;i++)
1114 task = &(simuctrl->
tasktab[i]);
1119 assert(cblknum < symbptr->cblknbr);
1120 assert(bloknum < symbptr->bloknbr);
1123 assert( simuctrl->
ownetab[cblknum] < 0 );
1124 simuctrl->
ownetab[cblknum] = pr;
1127 j < symbptr->cblktab[cblknum+1].bloknum; j++)
1160 #if defined(PASTIX_BLEND_GENTRACE)
1164 assert( (procnames != NULL) && (pr < ctrl->total_nbthrds) );
1165 assert( procnames[pr] != NULL );
1166 rc = asprintf( &str_val,
"Comp\" \"%d", (
int)i );
1167 setState(
timerVal( TIMER(pr) ),
"ST_TS", procnames[pr], str_val );
1181 for(j=simuctrl->
bloktab[b].
ftgtnum; j<simuctrl->bloktab[b+1].ftgtnum; j++)
1184 (j != CLUST2INDEX(b, clustnum)) )
1210 #if defined(PASTIX_BLEND_GENTRACE)
1214 assert( (procnames != NULL) && (pr < ctrl->total_nbthrds) );
1215 assert( procnames[pr] != NULL );
1216 rc = asprintf( &str_val,
"Wait\" \"%d", (
int)i );
1217 setState(
timerVal( TIMER(pr) ),
"ST_TS", procnames[pr], str_val );
1230 if(
timerVal(TIMER(pr)) > maxtime) {
1237 #if defined(PASTIX_BLEND_GENTRACE)
1239 assert( procnames != NULL );
1241 free(procnames[pr]);
1246 pastix_atomic_unlock( &trace_lock );
1250 #if defined(PASTIX_DEBUG_BLEND)
1251 for(i=0;i<simuctrl->
cblknbr;i++) {
1253 assert( simuctrl->
ownetab[i] >= 0 );
1255 for(i=0;i<symbptr->
bloknbr;i++) {
BEGIN_C_DECLS typedef int pastix_int_t
Processor candidate group to own a column blok.
Arrays of double to store the cost of each element in the matrix.
pastix_int_t * core2clust
pastix_int_t local_nbthrds
pastix_int_t total_nbcores
pastix_int_t total_nbthrds
void getCommunicationCosts(const BlendCtrl *ctrl, pastix_int_t clustsrc, pastix_int_t clustdst, pastix_int_t sync_comm_nbr, double *startup, double *bandwidth)
Return the communication cost between two cores.
The type and structure definitions.
void extendint_Add(ExtendVectorINT *, pastix_int_t)
Add an element elt to the end of the vector.
void pqueuePush2(pastix_queue_t *, pastix_int_t, double, double)
Insert an element into the sorted queue.
pastix_int_t pqueueRead(const pastix_queue_t *)
Read the first element of the queue.
pastix_int_t pqueueSize(const pastix_queue_t *)
Return the size of the queue.
static pastix_int_t pqueuePop(pastix_queue_t *q)
Pop the head of the queue whithout returning the keys.
pastix_int_t infotab[FTGT_MAXINFO]
pastix_queue_t * readytask
pastix_queue_t * futuretask
ExtendVectorINT * tasktab
static void simu_printBlockCtrbNbr(const BlendCtrl *ctrl, const symbol_matrix_t *symbptr, const SimuCtrl *simuctrl)
Print the number of contributions per cblk and block for debug.
static void simu_computeBlockCtrbNbr(const symbol_matrix_t *symbptr, SimuCtrl *simuctrl, pastix_int_t ricar)
Compute the number of contributions to each block.
static void simu_computeFtgtCosts(const BlendCtrl *ctrl, const SimuFtgt *ftgt, pastix_int_t clustsrc, pastix_int_t sync_comm_nbr, double *send, double *add)
Compute the cost of a communication and its update.
static void timerSetMax(SimuTimer *timer, double t)
Set the timer value if the value is greater than the actual one.
static double timerVal(const SimuTimer *timer)
Get the timer value.
static void simu_updateFtgt(const symbol_matrix_t *symbptr, SimuCtrl *simuctrl, pastix_int_t ftgtnum, pastix_int_t bloknum, pastix_int_t fbloknum)
Update the Fan In target structure.
static void simu_putInAllReadyQueues(const BlendCtrl *ctrl, SimuCtrl *simuctrl, pastix_int_t tasknum)
Insert a task in the ready task queues of all its candidates.
static void timerAdd(SimuTimer *timer, double t)
Increment the timer.
static void simu_pushToReadyHeap(const BlendCtrl *ctrl, SimuCtrl *simuctrl, pastix_int_t procnum)
Push all tasks from future to ready.
static void simu_computeTask(const BlendCtrl *ctrl, const symbol_matrix_t *symbptr, SimuCtrl *simuctrl, pastix_int_t tasknum)
Simulate the task execution.
static void simu_computeTaskReceiveTime(const BlendCtrl *ctrl, const symbol_matrix_t *symbptr, SimuCtrl *simuctrl, pastix_int_t tasknum)
Compute the instant t where the task will be received by a node.
static int timerComp(const SimuTimer *t1, const SimuTimer *t2)
Compare two timings.
static void timerSet(SimuTimer *timer, double t)
Set the timer value.
static pastix_int_t simu_getNextTaskNextProc(const BlendCtrl *ctrl, SimuCtrl *simuctrl, pastix_int_t *procnumptr)
Look for the best next couple (tasknum, corenum) that is ready to be executed.
Fan-in structure for the simulation.
Thread structure for the simulation.
Task structure for the simulation.
Timer for the simulation.
Control structure for the simulation.
FILE * pastix_fopenw(const char *dirname, const char *filename, const char *mode)
Open a file in the unique directory of the pastix instance.
void simuRun(SimuCtrl *, const BlendCtrl *, const symbol_matrix_t *)
Run the simulation to map the data on the nodes.
pastix_int_t pastixSymbolGetFacingBloknum(const symbol_matrix_t *symbptr, pastix_int_t bloksrc, pastix_int_t bloknum, pastix_int_t startsearch, int ricar)
Search the targeted block C for a couple of blocks A and B.
Symbol column block structure.