diff --git a/src/configuration.cc b/src/configuration.cc index f7cd18acbde3fa676fc00ba60f46cd1ad9e6eb0a..a28064ecfd614c9cb91705744036f24f7bd321b9 100644 --- a/src/configuration.cc +++ b/src/configuration.cc @@ -1,6 +1,6 @@ /* * This file is part of MUSIC. - * Copyright (C) 2007, 2008, 2009, 2012 INCF + * Copyright (C) 2007, 2008, 2009, 2012, 2021 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 @@ -123,11 +123,11 @@ namespace MUSIC { { std::istringstream env (configStr); setName (IOUtils::read (env)); - env.ignore (); + env.ignore (); // delim // do not need color information, // but we can use for error check - env.ignore (); - env.ignore (); + IOUtils::read (env); + env.ignore (); // delim applications_->read (env); env.ignore (); std::map<int, int> leaders = applications_->assignLeaders( Name ()); diff --git a/src/music/setup.hh b/src/music/setup.hh index 6b58b3e3dee79b58877c9b01f230c9404a331c5f..ed0262aa2c20ebaac1063bf74c241785e2d400c5 100644 --- a/src/music/setup.hh +++ b/src/music/setup.hh @@ -1,6 +1,6 @@ /* * This file is part of MUSIC. - * Copyright (C) 2007, 2008, 2009 INCF + * Copyright (C) 2007, 2008, 2009, 2021 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 @@ -94,6 +94,7 @@ namespace MUSIC { bool launchedByMusic_; bool postponeSetup_; + int color_; // Since we don't want to expose this internal interface to the // user we put the member functions in the private part and give diff --git a/src/setup.cc b/src/setup.cc index 5f2895a7510336015f03133b9cad9d4c8090cc63..3d2c473ee3e039b1c9ee4b9a083b1a1932934810 100644 --- a/src/setup.cc +++ b/src/setup.cc @@ -23,6 +23,7 @@ #include "music/parse.hh" #include "music/error.hh" #include "music/application_mapper.hh" +#include "music/ioutils.hh" #include <strings.h> #include <fstream> @@ -101,8 +102,17 @@ namespace MUSIC { assert(config.length() > 0); launchedByMusic_ = true; if (!config.compare (0, 8, "POSTPONE")) - postponeSetup_ = true; - config_ = new Configuration (config); + { + postponeSetup_ = true; + // *fixme* Error checking + std::istringstream in (config); + IOUtils::read (in); // POSTPONE + in.ignore (); // delim + std::string colorString = IOUtils::read (in); + color_ = atoi (colorString.c_str ()); + } + else + config_ = new Configuration (config); } else if (launchedMPMD (argc, argv, config)) { @@ -141,7 +151,7 @@ namespace MUSIC { argc = argc_; argv = argv_; } - comm = MPI::COMM_WORLD.Split (config_->Color (), myRank); + comm = MPI::COMM_WORLD.Split (postponeSetup_ ? color_ : config_->Color (), myRank); } else {