Skip to content
Snippets Groups Projects
Commit e4adae9e authored by Mikael Djurfeldt's avatar Mikael Djurfeldt
Browse files

Optionally do a Barrier call before creating the Runtime object

Call Barrier when given the option --adapter or -z to conform
to the protocol of the adapters in
github.com/incf-music/music-adapters.
parent a78a8e2c
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,7 @@ int maxbuffered = 0;
std::string imaptype = "linear";
std::string indextype = "global";
bool all = false;
bool useBarrier = false;
int
main (int argc, char* argv[])
......@@ -104,6 +105,7 @@ main (int argc, char* argv[])
{"imaptype", required_argument, 0, 'm'},
{"indextype", required_argument, 0, 'i'},
{"all", no_argument, 0, 'a'},
{"adapter", no_argument, 0, 'z'},
{"help", no_argument, 0, 'h'},
{"in", required_argument, 0, IN},
{"message-in", required_argument, 0, MESSAGE_IN},
......@@ -113,7 +115,7 @@ main (int argc, char* argv[])
int optionIndex = 0;
// the + below tells getopt_long not to reorder argv
int c = getopt_long (argc, argv, "+t:l:b:m:i:ah", longOptions, &optionIndex);
int c = getopt_long (argc, argv, "+t:l:b:m:i:azh", longOptions, &optionIndex);
// detect the end of the options
if (c == -1)
......@@ -149,6 +151,9 @@ main (int argc, char* argv[])
case 'a':
all = true;
continue;
case 'z':
useBarrier = true;
continue;
case IN:
portName = optarg;
continue;
......@@ -252,6 +257,9 @@ main (int argc, char* argv[])
double stoptime;
setup->config ("stoptime", &stoptime);
if (useBarrier)
MPI::COMM_WORLD.Barrier();
// Run
MUSIC::Runtime* runtime = new MUSIC::Runtime (setup, timestep);
......
/*
* This file is part of MUSIC.
* Copyright (C) 2008, 2009 INCF
* Copyright (C) 2008, 2009, 2018 INCF
*
* MUSIC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -78,6 +78,7 @@ string imaptype = "linear";
string indextype = "global";
string prefix;
string suffix = ".dat";
bool useBarrier = false;
void
getargs (int rank, int argc, char* argv[])
......@@ -93,13 +94,14 @@ getargs (int rank, int argc, char* argv[])
{"indextype", required_argument, 0, 'i'},
{"help", no_argument, 0, 'h'},
{"in", required_argument, 0, IN},
{"adapter", no_argument, 0, 'z'},
{0, 0, 0, 0}
};
/* `getopt_long' stores the option index here. */
int option_index = 0;
// the + below tells getopt_long not to reorder argv
int c = getopt_long (argc, argv, "+t:m:i:h", longOptions, &option_index);
int c = getopt_long (argc, argv, "+t:m:i:hz", longOptions, &option_index);
/* detect the end of the options */
if (c == -1)
......@@ -129,6 +131,9 @@ getargs (int rank, int argc, char* argv[])
case IN:
portName = optarg;
continue;
case 'z':
useBarrier = true;
continue;
case '?':
break; // ignore unknown options
case 'h':
......@@ -216,6 +221,9 @@ main (int argc, char *argv[])
double stoptime;
setup->config ("stoptime", &stoptime);
if (useBarrier)
MPI::COMM_WORLD.Barrier();
MUSIC::Runtime* runtime = new MUSIC::Runtime (setup, timestep);
double time = runtime->time ();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment