You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
longNCOL=0, /* number of collectives for which rules are provided */
73
+
COLID=0, /* identifies the collective type to associate the rules with */
74
+
NCOMSIZES=0, /* number of sets of message size rules. the key is communicator size */
75
+
COMSIZE=0, /* communicator size, the key identifying a specific set of message size rules. */
76
+
NMSGSIZES=0, /* number of message size rules in the set. */
77
+
MSGSIZE=0, /* message size, the key identifying a specific rule in the set. */
78
+
ALG=0, /* the collective specific algorithm to use */
79
+
FANINOUT=0, /* algorithm specific tuning parameter */
80
+
SEGSIZE=0, /* algorithm specific tuning parameter */
81
+
MAXREQ=0; /* algorithm specific tuning parameter */
61
82
FILE*fptr= (FILE*) NULL;
62
-
intx, ncs, nms;
83
+
intx, ncs, nms, version;
63
84
64
85
ompi_coll_alg_rule_t*alg_rules= (ompi_coll_alg_rule_t*) NULL; /* complete table of rules */
65
86
@@ -103,106 +124,131 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**
103
124
goto on_file_error;
104
125
}
105
126
106
-
if( (getnext(fptr, &X) <0) || (X<0) ) {
127
+
/* consume the optional version identifier */
128
+
if (0==fscanf(fptr, "rule-file-version-%u", &version)) {
129
+
version=1;
130
+
}
131
+
132
+
/* get the number of collectives for which rules are provided in the file */
133
+
if( (getnext(fptr, &NCOL) <0) || (NCOL<0) ) {
107
134
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read number of collectives in configuration file around line %d\n", fileline));
108
135
goto on_file_error;
109
136
}
110
-
if (X>n_collectives) {
111
-
OPAL_OUTPUT((ompi_coll_tuned_stream,"Number of collectives in configuration file %ld is greater than number of MPI collectives possible %d ??? error around line %d\n", X, n_collectives, fileline));
137
+
if (NCOL>n_collectives) {
138
+
OPAL_OUTPUT((ompi_coll_tuned_stream,"Number of collectives in configuration file %ld is greater than number of MPI collectives possible %d ??? error around line %d\n", NCOL, n_collectives, fileline));
112
139
goto on_file_error;
113
140
}
114
141
115
-
for (x=0;x<X;x++) { /* for each collective */
142
+
for (x=0;x<NCOL;x++) { /* for each collective */
116
143
117
-
if( (getnext(fptr, &CI) <0) || (CI<0) ) {
144
+
/* get the collective for which rules are being provided */
145
+
if( (getnext(fptr, &COLID) <0) || (COLID<0) ) {
118
146
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read next Collective id in configuration file around line %d\n", fileline));
119
147
goto on_file_error;
120
148
}
121
-
if (CI>=n_collectives) {
122
-
OPAL_OUTPUT((ompi_coll_tuned_stream,"Collective id in configuration file %ld is greater than MPI collectives possible %d. Error around line %d\n", CI, n_collectives, fileline));
149
+
if (COLID>=n_collectives) {
150
+
OPAL_OUTPUT((ompi_coll_tuned_stream,"Collective id in configuration file %ld is greater than MPI collectives possible %d. Error around line %d\n", COLID, n_collectives, fileline));
123
151
goto on_file_error;
124
152
}
125
153
126
-
if (alg_rules[CI].alg_rule_id!=CI) {
127
-
OPAL_OUTPUT((ompi_coll_tuned_stream, "Internal error in handling collective ID %ld\n", CI));
154
+
if (alg_rules[COLID].alg_rule_id!=COLID) {
155
+
OPAL_OUTPUT((ompi_coll_tuned_stream, "Internal error in handling collective ID %ld\n", COLID));
128
156
goto on_file_error;
129
157
}
130
-
OPAL_OUTPUT((ompi_coll_tuned_stream, "Reading dynamic rule for collective ID %ld\n", CI));
131
-
alg_p=&alg_rules[CI];
158
+
OPAL_OUTPUT((ompi_coll_tuned_stream, "Reading dynamic rule for collective ID %ld\n", COLID));
159
+
alg_p=&alg_rules[COLID];
132
160
133
-
alg_p->alg_rule_id=CI;
161
+
alg_p->alg_rule_id=COLID;
134
162
alg_p->n_com_sizes=0;
135
163
alg_p->com_rules= (ompi_coll_com_rule_t*) NULL;
136
164
137
-
if( (getnext (fptr, &NCS) <0) || (NCS<0) ) {
138
-
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read count of communicators for collective ID %ld at around line %d\n", CI, fileline));
165
+
/* get the number of communicator sizes for which a set of rules are to be provided */
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read communicator size for collective ID %ld com rule %d at around line %d\n", COLID, ncs, fileline));
155
185
goto on_file_error;
156
186
}
157
187
158
-
com_p->mpi_comsize=CS;
188
+
com_p->mpi_comsize=COMSIZE;
159
189
160
-
if( (getnext (fptr, &NMS) <0) || (NMS<0) ) {
161
-
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read number of message sizes for collective ID %ld com rule %d at around line %d\n", CI, ncs, fileline));
190
+
/* get the number of message sizes to specify rules for. inner set size */
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read number of message sizes for collective ID %ld com rule %d at around line %d\n", COLID, ncs, fileline));
162
193
goto on_file_error;
163
194
}
164
195
OPAL_OUTPUT((ompi_coll_tuned_stream, "Read message count %ld for dynamic rule for collective ID %ld and comm size %ld\n",
OPAL_OUTPUT((ompi_coll_tuned_stream,"Cannot allocate msg rules for file [%s]\n", fname));
170
201
goto on_file_error;
171
202
}
172
203
173
204
msg_p=com_p->msg_rules;
174
205
175
-
for (nms=0;nms<NMS;nms++) { /* for each msg size */
206
+
for (nms=0;nms<NMSGSIZES;nms++) { /* for each msg size */
176
207
177
208
msg_p=&(com_p->msg_rules[nms]);
178
209
179
-
if( (getnext (fptr, &MS) <0) || (MS<0) ) {
180
-
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read message size for collective ID %ld com rule %d msg rule %d at around line %d\n", CI, ncs, nms, fileline));
210
+
/* read the message size to associate the rule with */
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read message size for collective ID %ld com rule %d msg rule %d at around line %d\n", COLID, ncs, nms, fileline));
181
213
goto on_file_error;
182
214
}
183
-
msg_p->msg_size= (size_t)MS;
215
+
msg_p->msg_size= (size_t)MSGSIZE;
184
216
217
+
/* read the collective specific algorithm identifier */
185
218
if( (getnext (fptr, &ALG) <0) || (ALG<0) ) {
186
-
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read target algorithm method for collective ID %ld com rule %d msg rule %d at around line %d\n", CI, ncs, nms, fileline));
219
+
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read target algorithm method for collective ID %ld com rule %d msg rule %d at around line %d\n", COLID, ncs, nms, fileline));
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read fan in/out topo for collective ID %ld com rule %d msg rule %d at around line %d\n", CI, ncs, nms, fileline));
226
+
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read fan in/out topo for collective ID %ld com rule %d msg rule %d at around line %d\n", COLID, ncs, nms, fileline));
193
227
goto on_file_error;
194
228
}
195
229
msg_p->result_topo_faninout=FANINOUT;
196
230
197
-
if( (getnext (fptr, &SS) <0) || (SS<0) ) {
198
-
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read target segment size for collective ID %ld com rule %d msg rule %d at around line %d\n", CI, ncs, nms, fileline));
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read target segment size for collective ID %ld com rule %d msg rule %d at around line %d\n", COLID, ncs, nms, fileline));
199
234
goto on_file_error;
200
235
}
201
-
msg_p->result_segsize=SS;
236
+
msg_p->result_segsize=SEGSIZE;
237
+
238
+
/* read the max requests tuning parameter. optional */
OPAL_OUTPUT((ompi_coll_tuned_stream,"Could not read max requests for collective ID %ld com rule %d msg rule %d at around line %d\n", COLID, ncs, nms, fileline));
243
+
goto on_file_error;
244
+
}
245
+
msg_p->result_max_requests=MAXREQ;
246
+
}
202
247
203
-
if (!nms&&MS) {
248
+
/* check the first rule is for 0 size. look-up depends on this */
249
+
if (!nms&&MSGSIZE) {
204
250
OPAL_OUTPUT((ompi_coll_tuned_stream,"All algorithms must specify a rule for message size of zero upwards always first!\n"));
205
-
OPAL_OUTPUT((ompi_coll_tuned_stream,"Message size was %lu for collective ID %ld com rule %d msg rule %d at around line %d\n", MS, CI, ncs, nms, fileline));
251
+
OPAL_OUTPUT((ompi_coll_tuned_stream,"Message size was %lu for collective ID %ld com rule %d msg rule %d at around line %d\n", MSGSIZE, COLID, ncs, nms, fileline));
206
252
goto on_file_error;
207
253
}
208
254
@@ -219,13 +265,14 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t**
219
265
} /* comm size */
220
266
221
267
total_alg_count++;
222
-
OPAL_OUTPUT((ompi_coll_tuned_stream, "Done reading dynamic rule for collective ID %ld\n", CI));
268
+
OPAL_OUTPUT((ompi_coll_tuned_stream, "Done reading dynamic rule for collective ID %ld\n", COLID));
0 commit comments