PaStiX Handbook  6.3.2
simu.h
Go to the documentation of this file.
1 /**
2  *
3  * @file simu.h
4  *
5  * PaStiX simulation structure and basic functions.
6  *
7  * @copyright 2004-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8  * Univ. Bordeaux. All rights reserved.
9  *
10  * @version 6.3.2
11  * @author Pascal Henon
12  * @author Pierre Ramet
13  * @author Mathieu Faverge
14  * @date 2023-07-21
15  *
16  * @addtogroup blend_dev_simu
17  * @{
18  *
19  **/
20 #ifndef _simu_h_
21 #define _simu_h_
22 
23 #include "simu_timer.h"
24 
25 /**
26  * @brief Fan-in target information fields
27  * @warning The number of fields must be odd for memory alignment purpose.
28  */
29 typedef enum {
30  FTGT_CTRBNBR = 0, /**< Number of contributions */
31  FTGT_CTRBCNT, /**< Number of contributions remaining */
32  FTGT_PROCDST, /**< Destination for fanintarget */
33  FTGT_TASKDST, /**< Task destination */
34  FTGT_BLOKDST, /**< Block destination (->COMP_1D) */
35  FTGT_PRIONUM, /**< Fanintarget priority */
36  FTGT_FCOLNUM, /**< Fanintarget first column */
37  FTGT_LCOLNUM, /**< Fanintarget last column */
38  FTGT_FROWNUM, /**< Fanintarget first row */
39  FTGT_LROWNUM, /**< Fanintarget last row */
40  FTGT_MAXINFO
41 } simu_ftgt_e;
42 
43 /**
44  * @brief Process structure for the simulation.
45  */
46 typedef struct simu_cluster_s {
47  pastix_int_t fprocnum; /**< Global index of the first processor belonging to the cluster (Check is it is not redundant) */
48  pastix_int_t lprocnum; /**< Global index of the last processor belonging to the cluster (Check is it is not redundant) */
49  ExtendVectorINT *ftgtsend; /**< Arrays of ftgt sent by this proc (one vector per processor) */
50  pastix_int_t prionum; /**< Counter to order tasks on one cluster */
52 
53 /**
54  * @brief Thread structure for the simulation.
55  */
56 typedef struct simu_proc_s {
57  SimuTimer timer; /**< Simulated clock of the processor */
58  pastix_queue_t *readytask; /**< Heap of tasks ready to be executed */
59  pastix_queue_t *futuretask; /**< Heap of tasks ready to be executed in a near future (after timer) */
60  ExtendVectorINT *tasktab; /**< Vector to store tasks affected to the candidate */
61  char *procalias; /**< Paje trace alias to the processor if PASTIX_BLEND_GENTRACE is eenabled */
63 
64 /**
65  * @brief Fan-in structure for the simulation.
66  */
67 typedef struct simu_ftgt_s {
68  pastix_int_t infotab[FTGT_MAXINFO]; /**< Fan-in information array */
69  pastix_int_t clustnum; /**< Cluster sending the contribution */
70  SimuTimer timerecv; /**< Simulated clock of the reception time */
71  double costsend; /**< Cost to send the contribution */
72  double costadd; /**< Cost to add the contribution to its final cblk */
74 
75 /**
76  * @brief Column block structure for the simulation.
77  */
78 typedef struct simu_cblk_s {
79  pastix_int_t ctrbcnt; /**< Counter of remaining contributions for the cblk */
80  int8_t owned; /**< Boolean to indicate if owned by the local processor */
82 
83 /**
84  * @brief Block structure for the simulation.
85  */
86 typedef struct simu_blok_s {
87  pastix_int_t tasknum; /**< Task index opeating on this block (stored per block for 2D computations) */
88  pastix_int_t ftgtnum; /**< Index of the first fanin destinated to this
89  block in the ftgttab. This index is also used to find the first cblk timer
90  (one per cand proc) in the timetab array */
91  pastix_int_t ctrbcnt; /**< Counter of remaining contributions */
92  int fccandnum; /**< First candidate that is attributed to the cblk of the block */
93  int ownerclust; /**< Processor on which the block is distributed */
95 
96 /**
97  * @brief Task structure for the simulation.
98  */
99 typedef struct simu_task_s {
100  pastix_int_t prionum; /**< priority of the task */
101  pastix_int_t cblknum; /**< Number of the cblknum the task deals with */
102  pastix_int_t bloknum; /**< number of the block that the task deals with */
103  pastix_int_t bloknum2; /**< */
104  pastix_int_t facebloknum; /**< Number of the facing block for E2 */
105  SimuTimer time; /**< Time the task is ready if it doesn't need message */
106  pastix_int_t mesglen; /**< Time to send the block target */
107  double cost; /**< Cost of the task */
108  pastix_int_t ctrbcnt; /**< nbr ftgt + le btgt (+ E1 pret si E2) */
109  pastix_int_t ftgtcnt; /**< nbr of contrib from fan-in target */
110  pastix_int_t tasknext; /**< chainage des E1 ou E2, si fin = -1 => liberer les btagptr */
112 
113 /**
114  * @brief Control structure for the simulation.
115  */
116 typedef struct simuctrl_s {
117  pastix_int_t cblknbr; /**< Number of cblk */
118  pastix_int_t ftgtprio; /**< Priority to assign to current ftgts */
119  pastix_int_t tasknbr; /**< Number of tasks */
120  pastix_int_t ftgtcnt; /**< Number of received communication */
121  SimuTask *tasktab; /**< SimuTask vector */
122  SimuProc *proctab; /**< Virtual processor tab */
123  SimuCluster *clustab; /**< Virtual cluster tab */
124  pastix_int_t *ownetab; /**< Vector containing the distribution of the diagonal blok */
125  SimuCblk *cblktab; /**< SimuCblk vector */
126  SimuBlok *bloktab; /**< SimuBlok vector */
127  SimuFtgt *ftgttab; /**< Vector containing the fan in target */
128  pastix_int_t ftgtnbr; /**< The number of fan-in contribution */
129  SimuTimer *ftgttimetab; /**< Vector containing a timer for each cluster on each ftgt */
131 
135 void simuTaskBuild ( SimuCtrl *, const symbol_matrix_t * );
136 
137 #ifndef DOXYGEN_SHOULD_SKIP_THIS
138 #define CLUST2INDEX(n,c) ((c) + simuctrl->bloktab[n].ftgtnum - simuctrl->bloktab[n].fccandnum)
139 #define INDEX2CLUST(r,s) ((r) - simuctrl->bloktab[s].ftgtnum + simuctrl->bloktab[s].fccandnum)
140 #define TIMER(pr) (&(simuctrl->proctab[pr].timer))
141 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
142 
143 #endif /* _simu_h_ */
144 
145 /**
146  *@}
147  */
BEGIN_C_DECLS typedef int pastix_int_t
Definition: datatypes.h:51
Processor candidate group to own a column blok.
Definition: cand.h:28
The extend integer array structure.
Definition: extendVector.h:29
Queue structure.
Definition: queue.h:38
pastix_int_t tasknum
Definition: simu.h:87
pastix_int_t clustnum
Definition: simu.h:69
pastix_int_t infotab[FTGT_MAXINFO]
Definition: simu.h:68
SimuCluster * clustab
Definition: simu.h:123
SimuFtgt * ftgttab
Definition: simu.h:127
SimuProc * proctab
Definition: simu.h:122
pastix_int_t ftgtprio
Definition: simu.h:118
char * procalias
Definition: simu.h:61
pastix_queue_t * readytask
Definition: simu.h:58
pastix_int_t prionum
Definition: simu.h:50
pastix_queue_t * futuretask
Definition: simu.h:59
int8_t owned
Definition: simu.h:80
SimuTask * tasktab
Definition: simu.h:121
int ownerclust
Definition: simu.h:93
pastix_int_t ftgtcnt
Definition: simu.h:120
SimuTimer * ftgttimetab
Definition: simu.h:129
ExtendVectorINT * tasktab
Definition: simu.h:60
pastix_int_t ctrbcnt
Definition: simu.h:108
pastix_int_t cblknum
Definition: simu.h:101
double costadd
Definition: simu.h:72
pastix_int_t lprocnum
Definition: simu.h:48
SimuBlok * bloktab
Definition: simu.h:126
SimuTimer time
Definition: simu.h:105
pastix_int_t mesglen
Definition: simu.h:106
double cost
Definition: simu.h:107
pastix_int_t fprocnum
Definition: simu.h:47
pastix_int_t facebloknum
Definition: simu.h:104
pastix_int_t bloknum
Definition: simu.h:102
pastix_int_t tasknext
Definition: simu.h:110
pastix_int_t ftgtcnt
Definition: simu.h:109
SimuCblk * cblktab
Definition: simu.h:125
pastix_int_t ctrbcnt
Definition: simu.h:91
pastix_int_t prionum
Definition: simu.h:100
pastix_int_t ftgtnbr
Definition: simu.h:128
pastix_int_t * ownetab
Definition: simu.h:124
pastix_int_t ftgtnum
Definition: simu.h:88
pastix_int_t ctrbcnt
Definition: simu.h:79
pastix_int_t cblknbr
Definition: simu.h:117
pastix_int_t tasknbr
Definition: simu.h:119
SimuTimer timerecv
Definition: simu.h:70
SimuTimer timer
Definition: simu.h:57
double costsend
Definition: simu.h:71
int fccandnum
Definition: simu.h:92
ExtendVectorINT * ftgtsend
Definition: simu.h:49
struct simu_blok_s SimuBlok
Block structure for the simulation.
simu_ftgt_e
Fan-in target information fields.
Definition: simu.h:29
struct simu_cluster_s SimuCluster
Process structure for the simulation.
struct simuctrl_s SimuCtrl
Control structure for the simulation.
void simuExit(SimuCtrl *, pastix_int_t, pastix_int_t, pastix_int_t)
Free the simulation structure.
Definition: simu.c:254
pastix_int_t simuRealloc(SimuCtrl *, pastix_int_t, pastix_int_t)
Reallocate the simulation structures to compact them.
Definition: simu.c:205
struct simu_proc_s SimuProc
Thread structure for the simulation.
pastix_int_t simuInit(SimuCtrl *, const symbol_matrix_t *, const Cand *, pastix_int_t, pastix_int_t)
Initialize the simulation structures.
Definition: simu.c:66
struct simu_task_s SimuTask
Task structure for the simulation.
struct simu_cblk_s SimuCblk
Column block structure for the simulation.
struct simu_ftgt_s SimuFtgt
Fan-in structure for the simulation.
void simuTaskBuild(SimuCtrl *, const symbol_matrix_t *)
Initialize the tasktab array of the simulation structure.
Definition: simu_task.c:49
@ FTGT_LCOLNUM
Definition: simu.h:37
@ FTGT_PROCDST
Definition: simu.h:32
@ FTGT_CTRBNBR
Definition: simu.h:30
@ FTGT_TASKDST
Definition: simu.h:33
@ FTGT_FCOLNUM
Definition: simu.h:36
@ FTGT_CTRBCNT
Definition: simu.h:31
@ FTGT_BLOKDST
Definition: simu.h:34
@ FTGT_FROWNUM
Definition: simu.h:38
@ FTGT_PRIONUM
Definition: simu.h:35
@ FTGT_LROWNUM
Definition: simu.h:39
Block structure for the simulation.
Definition: simu.h:86
Column block structure for the simulation.
Definition: simu.h:78
Process structure for the simulation.
Definition: simu.h:46
Fan-in structure for the simulation.
Definition: simu.h:67
Thread structure for the simulation.
Definition: simu.h:56
Task structure for the simulation.
Definition: simu.h:99
Timer for the simulation.
Definition: simu_timer.h:25
Control structure for the simulation.
Definition: simu.h:116
Symbol matrix structure.
Definition: symbol.h:77