OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
interface.c File Reference
#include <space.h>

Go to the source code of this file.

Functions

elimtree_tSPACE_ordering (graph_t *G, options_t *options, timings_t *cpus)

Function Documentation

◆ SPACE_ordering()

elimtree_t * SPACE_ordering ( graph_t * G,
options_t * options,
timings_t * cpus )

Definition at line 47 of file interface.c.

48{ graph_t *Gc;
49 multisector_t *ms;
50 minprior_t *minprior;
51 elimtree_t *T, *T2;
53 options_t default_options[] = { SPACE_ORDTYPE, SPACE_NODE_SELECTION1,
56 PORD_INT *vtxmap, istage, totnstep, totnzf;
57 FLOAT totops;
58
59 /* --------------------------------------------------
60 set default options, if no other options specified
61 -------------------------------------------------- */
62 if (options == NULL)
63 options = default_options;
64
65 /* ----------------
66 reset all timers
67 ---------------- */
69 pord_resettimer(cpusOrd[TIME_MS]);
80
81 /* ------------------
82 compress the graph
83 ------------------ */
85 mymalloc(vtxmap, G->nvtx, PORD_INT);
86 Gc = compressGraph(G, vtxmap);
88
89 if (Gc != NULL)
90 { if (options[OPTION_MSGLVL] > 0)
91 printf("compressed graph constructed (#nodes %d, #edges %d)\n",
92 Gc->nvtx, Gc->nedges >> 1);
93 }
94 else
95 { Gc = G;
96 free(vtxmap);
97 if (options[OPTION_MSGLVL] > 0)
98 printf("no compressed graph constructed\n");
99 }
100
101 /* -------------------
102 compute multisector
103 ------------------- */
104
105
106 pord_starttimer(cpusOrd[TIME_MS]);
107 ms = constructMultisector(Gc, options, cpusOrd);
108 pord_stoptimer(cpusOrd[TIME_MS]);
109
110
111 if (options[OPTION_MSGLVL] > 0)
112 printf("quality of multisector: #stages %d, #nodes %d, weight %d\n",
113 ms->nstages, ms->nnodes, ms->totmswght);
114
115 /* ---------------------------------
116 compute minimum priority ordering
117 --------------------------------- */
119 minprior = setupMinPriority(ms);
120 T = orderMinPriority(minprior, options, cpusOrd);
122
123 if (options[OPTION_MSGLVL] > 0)
124 { totnstep = totnzf = 0;
125 totops = 0.0;
126 for (istage = 0; istage < ms->nstages; istage++)
127 { totnstep += minprior->stageinfo[istage].nstep;
128 totnzf += minprior->stageinfo[istage].nzf;
129 totops += minprior->stageinfo[istage].ops;
130 }
131 printf("quality of ordering: #steps %d, nzl %d, ops %e\n", totnstep,
132 totnzf, totops);
133 }
134
135 /* -----------------------
136 expand elimination tree
137 ----------------------- */
138 if (Gc != G)
139 { T2 = expandElimTree(T, vtxmap, G->nvtx);
140 freeElimTree(T);
141 freeGraph(Gc);
142 free(vtxmap);
143 }
144 else T2 = T;
145
146 /* --------------------------------------------------
147 pull back timing results, if vector cpus available
148 -------------------------------------------------- */
149 if (cpus != NULL)
150 { cpus[0] = cpusOrd[TIME_COMPRESS];
151 cpus[1] = cpusOrd[TIME_MS];
152 cpus[2] = cpusOrd[TIME_MULTILEVEL];
153 cpus[3] = cpusOrd[TIME_INITDOMDEC];
154 cpus[4] = cpusOrd[TIME_COARSEDOMDEC];
155 cpus[5] = cpusOrd[TIME_INITSEP];
156 cpus[6] = cpusOrd[TIME_REFINESEP];
157 cpus[7] = cpusOrd[TIME_SMOOTH];
158 cpus[8] = cpusOrd[TIME_BOTTOMUP];
159 cpus[9] = cpusOrd[TIME_UPDADJNCY];
160 cpus[10] = cpusOrd[TIME_FINDINODES];
161 cpus[11] = cpusOrd[TIME_UPDSCORE];
162 }
163
164 /* ----------------------
165 free memory and return
166 ---------------------- */
167 freeMultisector(ms);
168 freeMinPriority(minprior);
169 return(T2);
170}
#define TIME_COMPRESS
Definition const.h:89
#define SPACE_MSGLVL
Definition const.h:45
#define TIME_INITDOMDEC
Definition const.h:92
#define SPACE_DOMAIN_SIZE
Definition const.h:44
#define OPTION_MSGLVL
Definition const.h:83
#define TIME_REFINESEP
Definition const.h:95
#define TIME_UPDSCORE
Definition const.h:100
#define TIME_SMOOTH
Definition const.h:96
#define TIME_MULTILEVEL
Definition const.h:91
#define SPACE_ORDTYPE
Definition const.h:40
#define SPACE_NODE_SELECTION3
Definition const.h:43
#define TIME_COARSEDOMDEC
Definition const.h:93
#define TIME_FINDINODES
Definition const.h:99
#define TIME_INITSEP
Definition const.h:94
#define SPACE_NODE_SELECTION2
Definition const.h:42
#define TIME_BOTTOMUP
Definition const.h:97
#define TIME_MS
Definition const.h:90
#define SPACE_NODE_SELECTION1
Definition const.h:41
#define TIME_UPDADJNCY
Definition const.h:98
#define ORD_TIME_SLOTS
Definition const.h:87
#define pord_starttimer(var)
Definition macros.h:58
#define pord_resettimer(var)
Definition macros.h:55
#define pord_stoptimer(var)
Definition macros.h:61
#define mymalloc(ptr, nr, type)
Definition macros.h:23
elimtree_t * orderMinPriority(minprior_t *, options_t *, timings_t *)
multisector_t * constructMultisector(graph_t *, options_t *, timings_t *)
void freeMultisector(multisector_t *)
Definition multisector.c:86
minprior_t * setupMinPriority(multisector_t *)
void freeGraph(graph_t *)
Definition graph.c:73
graph_t * compressGraph(graph_t *, PORD_INT *)
Definition graph.c:470
elimtree_t * expandElimTree(elimtree_t *, PORD_INT *, PORD_INT)
Definition tree.c:517
void freeMinPriority(minprior_t *)
void freeElimTree(elimtree_t *)
Definition tree.c:132
PORD_INT nedges
Definition types.h:32
PORD_INT nvtx
Definition types.h:31
stageinfo_t * stageinfo
Definition types.h:132
PORD_INT totmswght
Definition types.h:94
PORD_INT nstages
Definition types.h:92
PORD_INT nnodes
Definition types.h:93
PORD_INT nzf
Definition types.h:143
PORD_INT nstep
Definition types.h:141
FLOAT ops
Definition types.h:144
double FLOAT
Definition types.h:23
FLOAT timings_t
Definition types.h:25
#define PORD_INT
Definition types.h:20
struct _minprior minprior_t
struct _multisector multisector_t
struct _graph graph_t
struct _elimtree elimtree_t
PORD_INT options_t
Definition types.h:24