DisCostiC v2.0.0
Distributed Cost in Cluster: a cross-architecture simulator for massively parallel MPI programs
Loading...
Searching...
No Matches
STREAM_COLLECTIVE.hpp
Go to the documentation of this file.
1#ifndef P2P_HPP
2#define P2P_HPP
3#include <tuple>
4#include <mpi.h>
5#include <string>
6
8#include "../include/AST.hpp"
10
11extern int scaling_cores;
12extern int bytes_to_send;
13
14// Global variables for setting individual system properties
15extern int virtual_rank;
16extern int system_number;
17extern int task_per_node;
18extern int node;
20extern int cores_per_socket;
21extern int cc_numa_domain;
22extern int socket;
23extern int primary_processes;
24extern int secondary_processes;
25extern int heteregeneous_mode;
26extern std::string arch_name;
27
28namespace DisCosTiC
29{
30
32 {
33
34 public:
40 {
42 //for collective mode, force single timestep
43 DisCosTiC_Datatype collective_mode = CFG_args->getValue<DisCosTiC_Datatype>("collective_mode");
44 if (collective_mode == 1) {
45 numTimesteps = 1;
46 } else {
47 numTimesteps = CFG_args->getValue<DisCosTiC_Datatype>("number_of_timesteps");
48 }
49 nodesCount = 0;
50 networksCount = 0;
51 }
52
53 /*DisCosTiC::tupleIdNodePair*/
55 {
56 DisCosTiC::Event recv, send, comp, collective;
58 // DisCosTiC::AST_OP root_Node;
59 // DisCosTiC::idNodePair compIDs(systemsize), sendIDs(systemsize), recvIDs(systemsize);
60
61 long int N_ = system_number == 0 ? CFG_args.getValue<long int>("N") : CFG_args.getValue<long int>("secondary_N");
62
63 int Nlocal = system_number == 0 ? N_ / primary_processes : N_ / secondary_processes;
64
65 int task_per_node_ = task_per_node;
66 int core = process_Rank;
67 int remainder_cores = systemsize > task_per_node_ ? systemsize % task_per_node_ : 0;
68 int ECM_core = 1;
69
70 assert(task_per_node_ <= (YAML_args.cores_per_chip * YAML_args.chips_per_node));
71
72 if (task_per_node_ != 1)
73 {
74 if (systemsize <= task_per_node_)
75 {
76 Nlocal = Nlocal * std::min(task_per_node_, cores_per_socket);
77 ECM_core = std::min(task_per_node_, cores_per_socket);
78 }
79 else if (remainder_cores == 0)
80 {
81 Nlocal = Nlocal * std::min(task_per_node_, cores_per_socket);
82 ECM_core = std::min(task_per_node_, cores_per_socket);
83 }
84 else
85 {
86 if (core <= systemsize - remainder_cores)
87 {
88 Nlocal = Nlocal * std::min(task_per_node_, cores_per_socket);
89 ECM_core = std::min(task_per_node_, cores_per_socket);
90 }
91 else
92 {
93 Nlocal = Nlocal * remainder_cores;
94 ECM_core = remainder_cores;
95 }
96 }
97 }
98
99 for (auto rank : DisCosTiC::getRange(systemsize))
100 {
101
102 DisCosTiC->Rank_Init(rank);
103 DisCosTiC->SetNumRanks(systemsize); // std::cout <<DisCosTiC->ranks<< std::endl; //18
104 recv.first = INVALID_ID;
105 send.first = INVALID_ID;
106 comp.first = INVALID_ID;
107 collective.first = INVALID_ID;
108
109 //for collectives: computation (STREAM) followed by collective
110 //only single timestep (collective_mode = 1)
111
112 comp = DisCosTiC->Exec("FILE:stream-triad.c//BREAK:" + CFG_args.getValue<std::string>("benchmark_kernel") +
113 "//./nodelevel/machine-files/" + arch_name + ".yml//" +
114 std::to_string(ECM_core) + "+" + std::to_string(remainder_cores) +
115 "//-D N " + std::to_string(Nlocal) + " -D s " + std::to_string(55),
116 recv, YAML_args, process_Rank, N_size_Of_Cluster, comm);
117
118 comp.second->bufSize = (comp.second->bufSize * Nlocal);
119
120 DisCosTiC_Datatype root = 0;
121 DisCosTiC_Datatype coll_type_id = CFG_args.getValue<DisCosTiC_Datatype>("collective_type");
122 DisCosTiC_Datatype coll_algo = CFG_args.getValue<DisCosTiC_Datatype>("collective_algorithm");
123 DisCosTiC_Datatype coll_bytes = CFG_args.getValue<DisCosTiC_Datatype>("collective_bytes");
124 DisCosTiC::CollectiveType coll_type = static_cast<DisCosTiC::CollectiveType>(coll_type_id);
125
126 //collective DSEL — type/algorithm/bytes from config.cfg
127 collective = DisCosTiC->Collective
128 (
129 coll_type,
130 root, coll_bytes,
131 rank, systemsize, comp,
132 static_cast<uint8_t>(coll_algo)
133 );
134
135 numOperations = DisCosTiC->getNumOps(); // DisCosTiC->allNodes.size(); //15
136 ID[rank].resize(numOperations);
137
141 for (std::vector<DisCosTiC::AST_OP *>::iterator it = DisCosTiC->allNodes.begin(); it != DisCosTiC->allNodes.end(); it++)
142 { // DisCosTiC->allNodes.size():15
143 if ((**it).depCount == 0)
144 DisCosTiC->RootNodes.push_back(*it); // DisCosTiC->RootNodes.size():1
145 }
146
147 DisCosTiC_Datatype count = 0;
149
150 for (std::vector<DisCosTiC::AST_OP *>::iterator it = DisCosTiC->allNodes.begin(); it != DisCosTiC->allNodes.end(); it++)
151 {
152 N.depCount = (**it).depCount;
153 N.type = (**it).type;
154 N.target = (**it).target;
155 N.bufSize = (**it).bufSize;
156 N.tag = (**it).tag;
157 N.node = (**it).node;
158 N.network = (**it).network;
159 N.label = (**it).label;
160 N.mode = (**it).mode;
161 N.algorithm = (**it).algorithm;
162 N.collectiveType = (**it).collectiveType;
163 N.collectiveRoot = (**it).collectiveRoot;
164 N.collectiveNumRanks = (**it).collectiveNumRanks;
165 N.depsCount = (**it).DepOperations.size();
166 N.depApdxStartLabel = count;
167 count += (**it).DepOperations.size();
168 N.idepsCount = (**it).IdepOperations.size();
169 N.idepApdxStartLabel = count;
170 count += (**it).IdepOperations.size();
171 // DisCosTiC->insertdeserialID(indicesDeserializedTable, toCharPointer(rank) , N);
172 ID[rank][(**it).label] = std::make_pair(rank, N);
173 }
174
175 DisCosTiC->Rank_Finalize();
176 }
177 DisCosTiC->File_Write();
178 // delete DisCosTiC;
179 /*print_pairedVec_NonPointer2T(ID);
180 print_pairedVec2T(compIDs);
181 print_pairedVec2T(sendIDs);
182 print_pairedVec2T(recvIDs);
183 DisCosTiC->print_indicesTable();
184 DisCosTiC->print_depTable();
185 DisCosTiC->print_indicesDeserializedTable();*/
186 return ID; // std::make_tuple(compIDs,sendIDs,recvIDs); //(root_Node,*send.second,*recv.second);
187 }
188
192 uint8_t
194 {
195 return nodesCount + 1;
196 }
197
202 {
203 return networksCount + 1;
204 }
205
210 {
211 }
212
213 public:
218
219 private:
220 // AST *DisCosTiC;
222
225 };
226
227 using VecGraph_t = std::vector<Benchmark>;
228
229}
230
231#endif
UserInterface::ConfigParser CFG_args("config.cfg")
< configuration file parser
std::size_t DisCosTiC_Datatype
Definition DataType.hpp:52
int secondary_processes
Definition DisCosTiC.cpp:71
int heteregeneous_mode
Definition DisCosTiC.cpp:72
int system_number
Definition DisCosTiC.cpp:63
int primary_processes
Definition DisCosTiC.cpp:70
int cores_per_socket
Definition DisCosTiC.cpp:67
int task_per_node
Definition DisCosTiC.cpp:64
std::string arch_name
Definition DisCosTiC.cpp:77
int virtual_rank
Definition DisCosTiC.cpp:62
int secondary_processes
Definition DisCosTiC.cpp:71
int socket
Definition DisCosTiC.cpp:69
int scaling_cores
Definition AST.hpp:36
int heteregeneous_mode
Definition DisCosTiC.cpp:72
int system_number
Definition DisCosTiC.cpp:63
int primary_processes
Definition DisCosTiC.cpp:70
int cores_per_socket
Definition DisCosTiC.cpp:67
int bytes_to_send
Definition AST.hpp:37
int task_per_node
Definition DisCosTiC.cpp:64
int cc_numa_domain_per_socket
Definition DisCosTiC.cpp:66
std::string arch_name
Definition DisCosTiC.cpp:77
int cc_numa_domain
Definition DisCosTiC.cpp:68
int node
Definition DisCosTiC.cpp:65
end AST_HPP
Definition AST.hpp:58
end of Benchmark class
DisCosTiC_Datatype systemsize
DisCosTiC::VecDeserialNode Nodes
uint8_t GetNumNetworks()
the maximum number of the network interface controller
DisCosTiC_Datatype numOperations
DisCosTiC::idNodeTypePair Oneway_PositiveDisplacement(AST *DisCosTiC, DisCosTiC_Datatype process_Rank, UserInterface::YAMLParser YAML_args, DisCosTiC_Datatype N_size_Of_Cluster, MPI_Comm comm)
end of Oneway_PositiveDisplacement
uint8_t GetNumCores()
the maximum number of the nodes
DisCosTiC_Datatype networksCount
DisCosTiC_Datatype nodesCount
Benchmark(UserInterface::ConfigParser *CFG_args)
constructor that initializes the coordinates
DisCosTiC_Datatype datasize
DisCosTiC_Datatype numTimesteps
a wrapper class which contains functions for parsing the configuration file end class configParser
scalarT getValue(const std::string &key, scalarT const &defaultValue=scalarT()) const
a function that retrieves the value of a specific key
end class YAMLParser
DisCosTiC_Datatype cores_per_chip
DisCosTiC_Datatype chips_per_node
static const DisCosTiC_Indextype INVALID_ID
< data types
Definition macro.hpp:15
< benchmark test cases
std::pair< DisCosTiC_Indextype, DisCosTiC::AST_OP * > Event
CollectiveType
Definition enum.hpp:38
std::vector< std::vector< idNodeTypePairT > > idNodeTypePair
std::vector< Benchmark > VecGraph_t
std::vector< AST_OP_TYPE > VecDeserialNode
iteratorRange< scalarT > getRange(scalarT begin, scalarT end)
Definition DataType.hpp:161
DisCosTiC_Indextype depCount
DisCosTiC_Indextype depApdxStartLabel
DisCosTiC_Datatype bufSize
DisCosTiC_Indextype collectiveNumRanks
nubmer of ranks participating in collective
DisCosTiC_Indextype network
DisCosTiC_Indextype idepsCount
DisCosTiC_Indextype idepApdxStartLabel
DisCosTiC_Indextype label
DisCosTiC_Indextype target
uint8_t collectiveType
collective operation type
DisCosTiC_Indextype tag
char mode
TODO: add blocking/non-blocking mode.
DisCosTiC_Indextype collectiveRoot
root rank for collectives which have root (-1 if no root)
DisCosTiC_Indextype depsCount
uint8_t algorithm
algo choice for collective
DisCosTiC_Indextype node