160 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
172 if (run_config_file.good()) {
175 run_config_file.close();
177 cerr << __FILE__ <<
":" << __LINE__ <<
"Couldn't open or read run config file " +
run_config_file_name
179 MPI_Abort(MPI_COMM_WORLD, 1);
185 if (user_config_file.good()) {
188 user_config_file.close();
190 cerr << __FILE__ <<
":" << __LINE__ <<
"Couldn't open or read user config file " +
user_config_file_name
192 MPI_Abort(MPI_COMM_WORLD, 1);
198 if (global_config_file.good()) {
201 global_config_file.close();
205 MPI_Abort(MPI_COMM_WORLD, 1);
212 MPI_Bcast(&hasVersionOption,
sizeof(
bool), MPI_BYTE, 0, MPI_COMM_WORLD);
213 if (hasVersionOption) {
222 MPI_Bcast(&hasRunConfigFile,
sizeof(
bool), MPI_BYTE, 0, MPI_COMM_WORLD);
225 cout <<
"Run config file required. Use --help to list all options" << endl;
231 int nOptionsToBroadcast;
233 const int maxStringLength = 1024;
234 char value[maxStringLength];
235 char name[maxStringLength];
236 value[maxStringLength - 1] =
'\0';
237 name[maxStringLength - 1] =
'\0';
247 nOptionsToBroadcast = 0;
250 nOptionsToBroadcast++;
254 MPI_Bcast(&nOptionsToBroadcast, 1, MPI_INT, 0, MPI_COMM_WORLD);
257 for (map<string, string>::iterator p =
options.begin(); p !=
options.end(); ++p) {
260 strncpy(name, p->first.c_str(), maxStringLength - 1);
261 strncpy(value, p->second.c_str(), maxStringLength - 1);
262 MPI_Bcast(name, maxStringLength, MPI_CHAR, 0, MPI_COMM_WORLD);
263 MPI_Bcast(value, maxStringLength, MPI_CHAR, 0, MPI_COMM_WORLD);
269 for (
int p = 0; p < nOptionsToBroadcast; p++) {
270 MPI_Bcast(name, maxStringLength, MPI_CHAR, 0, MPI_COMM_WORLD);
271 MPI_Bcast(value, maxStringLength, MPI_CHAR, 0, MPI_COMM_WORLD);
273 string sValue(value);
286 nOptionsToBroadcast = 0;
289 nOptionsToBroadcast++;
294 MPI_Bcast(&nOptionsToBroadcast, 1, MPI_INT, 0, MPI_COMM_WORLD);
299 strncpy(name, p->first.c_str(), maxStringLength - 1);
300 MPI_Bcast(name, maxStringLength, MPI_CHAR, 0, MPI_COMM_WORLD);
302 MPI_Bcast(&vectorSize, 1, MPI_INT, 0, MPI_COMM_WORLD);
305 strncpy(value, v->c_str(), maxStringLength - 1);
306 MPI_Bcast(value, maxStringLength, MPI_CHAR, 0, MPI_COMM_WORLD);
313 for (
int p = 0; p < nOptionsToBroadcast; p++) {
314 MPI_Bcast(name, maxStringLength, MPI_CHAR, 0, MPI_COMM_WORLD);
316 MPI_Bcast(&vectorSize, 1, MPI_INT, 0, MPI_COMM_WORLD);
317 for (
int i = 0;
i < vectorSize;
i++) {
318 MPI_Bcast(value, maxStringLength, MPI_CHAR, 0, MPI_COMM_WORLD);
319 string sValue(value);