23#define print_vec1T(vec) \
26 for (auto i : DisCosTiC::getRange(vec.size())) \
27 std::cout << (i ? " , " : "") << vec[i]; \
28 std::cout << " }" << std::endl; \
35#define print_vec2T(vec) \
37 for (auto i : DisCosTiC::getRange(vec[0].size())) \
39 for (auto j : DisCosTiC::getRange(vec[i].size())) \
41 std::cout << "[" << i << "][" << j << "]=" << vec[i][j] << std::endl; \
50#define print_pairedVec2T(vec) \
52 for (auto i : DisCosTiC::getRange(vec.size())) \
54 for (auto j : DisCosTiC::getRange(vec[i].size())) \
56 std::cout << "[" << i << "][" << j << "]:" \
57 << "\t label = " << vec[i][j].first << "\t AST_OP info : "; \
58 print_DeserialNodeT(+vec[i][j].second); \
63#define print_pairedVecNonPointer2T(vec) \
65 for (auto i : DisCosTiC::getRange(vec.size())) \
66 for (auto j : DisCosTiC::getRange(vec[i].size())) \
67 std::cout << "[" << i << "][" << j << "]:" \
68 << "\t label = " << vec[i][j].first << "\t AST_OP info : "; \
69 print_DeserialNodeNonPointerT(+vec[i][j].second); \
74#define print_pairedVec_NonPointer2T(vec) \
76 for (auto i : DisCosTiC::getRange(vec.size())) \
78 for (auto j : DisCosTiC::getRange(vec[i].size())) \
80 std::cout << "[" << i << "][" << j << "]:" \
81 << "\t label = " << vec[i][j].first << "\t AST_OP info : "; \
82 print_AST_OP_NonPointerT(+vec[i][j].second); \
91#define itFirst_Vec2T(vec) \
93 for (auto &row : vec) \
95 for (auto &col : row) \
96 std::cout << col.first << std::endl; \
108#define iqueueOpecond_Vec2T(vec) \
110 for (auto &row : vec) \
112 for (auto &col : row) \
121#define print_vec3T(vec) \
123 for (auto i : DisCosTiC::getRange(vec[0].size())) \
125 for (auto j : DisCosTiC::getRange(vec[i].size())) \
127 for (auto k : DisCosTiC::getRange(vec[j].size())) \
129 std::cout << "[" << i << "][" << j << "][" << k << "]=" << vec[i][j][k] << std::endl; \
139#define print_OpPropertiesT(op) \
141 std::cout << "time: " << op->time \
142 << " starttime: " << op->starttime \
143 << " syncstart: " << op->syncstart \
144 << " numOpsInQueue: " << op->numOpsInQueue \
145 << " bufSize: " << op->bufSize \
146 << " target: " << op->target \
147 << " rank: " << op->rank \
148 << " label: " << op->label \
149 << " tag: " << op->tag \
150 << " node: " << +op->node \
151 << " network: " << +op->network \
152 << " type: " << +op->type << std::endl; \
158#define print_OpPropertiesNonPointerT(op) \
160 std::cout << " rank: " << op.rank \
161 << " time: " << op.time \
162 << " starttime: " << op.starttime \
163 << " syncstart: " << op.syncstart \
164 << " numOpsInQueue: " << op.numOpsInQueue \
165 << " bufSize: " << op.bufSize \
166 << " target: " << op.target << " label: " << op.label \
167 << " tag: " << op.tag \
168 << " node: " << +op.node \
169 << " network: " << +op.network \
170 << " type: " << +op.type \
171 << " mode : " << +op.mode << std::endl; \
177#define print_DeserialNodeT(op) \
179 std::cout << "DepOperations: " << op->DepOperations.size() \
180 << " IdepOperations: " << op->IdepOperations.size() \
181 << " depCount: " << op->depCount \
182 << " target: " << op->target \
183 << " label: " << op->label \
184 << " tag: " << op->tag \
185 << " node: " << +op->node \
186 << " network: " << +op->network \
187 << " type: " << +op->type \
188 << " bufSize: " << op->bufSize \
195#define print_DeserialNodeNonPointerT(op) \
197 std::cout << "DepOperations.size(): " << op.DepOperations.size() \
198 << " IdepOperations.size(): " << op.IdepOperations.size() \
199 << " depCount: " << op.depCount \
200 << " target: " << op.target \
201 << " label: " << op.label \
202 << " tag: " << op.tag \
203 << " node: " << +op.node \
204 << " network: " << +op.network \
205 << " type: " << +op.type \
206 << " bufSize: " << op.bufSize \
213#define print_AST_OP_NonPointerT(op) \
215 std::cout << "num_deps: " << op.num_deps \
216 << " deps_startlabel_in_apdx: " << op.deps_startlabel_in_apdx \
217 << " num_startdeps.bufSize(): " << op.num_startdeps \
218 << " startdeps_startlabel_in_apdx: " << op.startdeps_startlabel_in_apdx \
219 << " depCount: " << op.depCount \
220 << " target: " << op.target \
221 << " label: " << op.label \
222 << " tag: " << op.tag \
223 << " node: " << +op.node \
224 << " network: " << +op.network \
225 << " type: " << +op.type \
226 << " bufSize: " << op.bufSize \
233#define fileopen(myfile, filename) \
237 myfile.open(filename); \
239 catch (std::ifstream::failure const &e) \
241 std::cerr << "error: opening file definition of " \
242 << this->filename << " for reading, with message '" \
243 << e.what() << std::endl; \
244 std::exit(EXIT_FAILURE); \
251#define fileclose(myfile, filename) \
253 if (myfile.is_open()) \
259 catch (std::ofstream::failure const &e) \
261 std::cerr << "error: closing file definition of " << this->filename << " for writing" << std::endl; \
262 std::exit(EXIT_FAILURE); \
271#define AppendString(str, content) \
273 this->content.append(str); \
280#define toCharPointer(content) \
282 const_cast<char *>(("l" + std::to_string(content)).c_str()) \
288#define max_vec1T(vec) \
290 DisCosTiC_Datatype max = 0; \
291 for (auto i : DisCosTiC::getRange(vec.size())) \
292 max = std::max(max, vec[i].size()); \
299#define progessPrint(progress, qCounter, q1, q2, q3) \
301 std::cout << "Discostic Progress: " << progress \
302 << " % (queue counter: " << qCounter << ") "; \
303 std::cout << "[Queue bufSize: " << q1.size() << " Max Receive Queue bufSize: "; \
305 std::cout << " Max Unexpected Message Queue bufSize: "; \
307 std::cout << "]" << std::endl; \
313#define queues_empty_check(check, q) \
314 for (auto rank : DisCosTiC::getRange(numRanks)) \
316 if (!q[rank].empty()) \
318 std::cerr << " queue on rank " << rank \
319 << " contains " << q[rank].size() \
321 for (DisCosTiC::ListqueueOp::iterator iter = q[rank].begin(); iter != q[rank].end(); ++iter) \
322 std::cerr << "\t [ source ==> " << iter->src \
323 << ", tag ==> " << iter->tag \
324 << "]" << std::endl; \
332#define allRanksTime(numRanks, nexto) \
333 std::cout << "\nFULL APPLICATION PERFORMANCE (for all ranks):" << std::endl; \
334 std::cout << "----------------------------------------------------------------" << std::endl; \
335 std::cout << "rank runtime [ns] runtime [s]" << std::endl; \
336 std::cout << "----------------------------------------------------------------" << std::endl; \
337 for (auto rank : DisCosTiC::getRange(numRanks)) \
339 DisCosTiC_Timetype maxo = *(std::max_element(nexto[rank].begin(), nexto[rank].end())); \
340 std::cout << rank << " " << maxo << " " << maxo / 1e9 << std::endl; \
346#define slowRankTime(numRanks, nexto) \
347 std::cout << "\nFULL APPLICATION PERFORMANCE (for slowest rank):" << std::endl; \
348 DisCosTiC_Timetype max = 0; \
349 DisCosTiC_Datatype rank = 0; \
350 for (auto rank : DisCosTiC::getRange(numRanks)) \
352 DisCosTiC_Timetype maxo = *(std::max_element(nexto[rank].begin(), nexto[rank].end())); \
353 DisCosTiC_Timetype cur = maxo; \
360 std::cout << "----------------------------------------------------------------" << std::endl; \
361 std::cout << "rank runtime [ns] runtime [s]" << std::endl; \
362 std::cout << "----------------------------------------------------------------" << std::endl; \
363 std::cout << rank << " \t\t " << max << " \t\t " << max / 1e9 << std::endl;
368#define verboseCompInitPrint(rank, operation) \
369 std::cout << "initialize rank: " << rank \
370 << " [ node: " << +operation.node \
371 << ", network: " << +operation.network \
372 << "] computation: " << operation.bufSize << std::endl;
374#define verboseCompFinalPrint(rank, operation) \
375 std::cout << "rank: " << rank \
376 << " [ node: " << +operation.node \
377 << ", network: " << +operation.network \
378 << "] computation: " << operation.bufSize \
379 << ", time: " << operation.time \
380 << ", label: " << operation.label << std::endl;
382#define verboseSendInitPrint(rank, operation) \
383 std::cout << "initialize rank: " << rank \
384 << " [ node: " << +operation.node \
385 << ", network: " << +operation.network \
386 << "] send to: " << operation.target \
387 << "tag: " << operation.tag \
388 << " bufSize: " << operation.bufSize << std::endl;
390#define verboseSendFinalPrint(rank, operation) \
391 std::cout << "rank: " << rank \
392 << " [ node: " << +operation.node \
393 << ", network: " << +operation.network \
394 << "] send to: " << operation.target \
395 << ", tag: " << operation.tag \
396 << ", bufSize: " << operation.bufSize \
397 << ", time: " << operation.time \
398 << ", label: " << operation.label << std::endl;
400#define verboseRecvInitPrint(rank, operation) \
401 std::cout << "initialize rank: " << rank \
402 << " [ node: " << +operation.node \
403 << ", network: " << +operation.network \
404 << "] receive from: " << operation.target \
405 << "tag: " << operation.tag \
406 << " bufSize: " << operation.bufSize << std::endl;
408#define verboseRecvFinalPrint(rank, operation) \
409 std::cout << "rank: " << rank \
410 << " [ node: " << +operation.node \
411 << ", network: " << +operation.network \
412 << "] receive from: " << operation.target \
413 << ", tag: " << operation.tag \
414 << ", bufSize: " << operation.bufSize \
415 << ", time: " << operation.time \
416 << ", label: " << operation.label << std::endl;
418#define verboseCompPrint(operation) \
420 std::cout << "\n[rank: " << operation.rank \
421 << ", node: " << +operation.node \
422 << "]:" << std::endl; \
423 std::cout << "local operation bufSize= " << operation.bufSize \
424 << " ns, total time= " << operation.time \
425 << " ns" << std::endl; \
428#define verboseSendPrint(operation) \
430 std::cout << "\n[rank: " << operation.rank \
431 << ", node: " << +operation.node \
432 << "]:" << std::endl; \
433 std::cout << "send to rank " << operation.target \
434 << ", total time= " << operation.time \
435 << " ns" << std::endl; \
438#define verboseSendIrequiresPrint(operation) \
440 std::cout << "satisfy local non-blocking dependencies" << std::endl; \
441 std::cout << "send inserting msg to rank " << operation.rank \
442 << ", total time= " << operation.time << " ns" << std::endl; \
445#define verboseEagerSendPrint(o, operation) \
446 std::cout << "eager satisfy local requires at total time = " << operation.starttime + o \
447 << " ns" << std::endl;
449#define verboseRendezvousSendPrint(operation) \
450 std::cout << "start rendezvous message to: " << operation.rank \
451 << " (label: " << operation.label \
454#define verboseRecvPrint(operation) \
456 std::cout << "\n[rank: " << operation.rank \
457 << ", node: " << +operation.node \
458 << "]:" << std::endl; \
459 std::cout << "receive from rank " << operation.target \
460 << " , total time= " << operation.time \
461 << " ns" << std::endl; \
464#define verboseRendezvousRecvPrint(operation) \
465 std::cout << "satisfy remote requires at rank " << operation.target \
466 << " (label: " << operation.label \
469#define verboseMsgPrint(operation, oSuccessor, grSuccessor) \
471 std::cout << "\n[rank: " << operation.rank \
472 << ", node: " << +operation.node \
473 << "]:" << std::endl; \
474 std::cout << "receive msg from rank " << operation.target \
475 << ", total time= " << operation.time \
476 << " ns" << std::endl; \
477 std::cout << "o= " << oSuccessor[operation.rank][operation.node] \
478 << " ns, successor gr= " << grSuccessor[operation.rank][operation.network] \
479 << " ns" << std::endl; \
486 << "\n==================================================" << std::endl \
487 << " Parameter for config.cfg" << std::endl \
488 << "==================================================" << std::endl \
491 << "\t task_per_node" \
492 << "\t\t\t number of runing processes on one node" << std::endl; \
494 << "\t number_of_processes" \
495 << "\t\t number of runing processes on all nodes" << std::endl; \
498 << "\t\t\t 1 to insert delay and create idlewave." << std::endl; \
501 << "\t\t\t which rank should introduce the disturbance" << std::endl; \
503 << "\t at_timestep" \
504 << "\t\t\t at which timestep the given rank should introduce the disturbance" << std::endl; \
507 << "\t\t\t\t 0 to turn off the desynchronization feature and 1 to turn on." << std::endl; \
510 << "\t\t\t 0 for LogGP model and 1 for HOCKNEY model" << std::endl; \
513 << "\t\t\t [optional: for debug puspose] output file name that contain details of the generated graph" << std::endl; \
515 << "\t timeunit_conv" \
516 << "\t\t\t time multiplier for conversation from baseline unit of nanoseconds to some other unit" << std::endl; \
518 << "\t chromevizfilename" \
519 << "\t\t the name of the output file contains all time rank tracing data for visulization with Chrome tracing browser" << std::endl; \
522 << "\t\t\t enable/disable more verbose output (0=disable, 1=enable)" << std::endl; \
525 << "\t\t\t enable/disable batchmode (0=disable i.e., printing performance for each rank, 1=enable i.e., never print detailed all rank info)" << std::endl; \
527 << "\t micro_architecture" \
528 << "\t\t\t " << std::endl; \
530 << "\t FP_instructions_per_cycle" \
531 << "\t\t\t " << std::endl; \
533 << "\t benchmark_kernel" \
534 << "\t\t\t " << std::endl; \
537 << "\t\t\t choose either of FILE, SRC, LBL, SRC modes. Concatenated with benchmark kernel during runtime to determine which P2P file to use." << std::endl; \
539 << "\t FLOPs_per_iteration" \
540 << "\t\t number of flops in one iteration" << std::endl; \
543 << "\t\t\t number of read streams" << std::endl; \
546 << "\t\t\t number of write streams" << std::endl; \
548 << "\t datasize_in_GB" \
549 << "\t\t\t number of array elements * (R_streams + W_streams) * size of datatype" << std::endl; \
552 << "\t\t\t penalty in nanoseconds. Used only in LBL and COMP mode." << std::endl; \
554 << "\t compiler-flags" \
555 << "\t\t\t " << std::endl; \
558 << "\t\t\t " << std::endl; \
561 << "\t\t\t " << std::endl; \
563 << "\t cache-predictor" \
564 << "\t\t\t " << std::endl; \
566 << "\n\t Other user defined P2P file parameters for domain size etc. etc." \
571 std::cout << "\nDistributed CosT in Cluster ( DisCosTiC )" << std::endl; \
572 std::cout << "Version : v2.0.0 (second release)" << std::endl; \
573 std::cout << "Author : Ayesha Afzal <ayesha.afzal@fau.de>" << std::endl; \
574 std::cout << "Copyright : 2023 HPC, FAU Erlangen-Nuremberg. All rights reserved" << std::endl; \
std::size_t DisCosTiC_Indextype
static const DisCosTiC_Indextype MPI_ANY_SOURC
static const DisCosTiC_Indextype INVALID_ID
< data types
static const DisCosTiC_Indextype MPI_ANY_TA