diff --git a/music-config/__init__.py b/music-config/__init__.py index 35c1a79..63ffbf4 100644 --- a/music-config/__init__.py +++ b/music-config/__init__.py @@ -16,6 +16,6 @@ # along with this program. If not, see . # -from predict_rank import predictRank +from music import predictRank from config import launchedByMusic, supersedeArgv, postponeSetup, \ define, Application, connect, configure, launch diff --git a/music-config/config.py b/music-config/config.py index e7a3b81..b024264 100644 --- a/music-config/config.py +++ b/music-config/config.py @@ -21,7 +21,7 @@ import os -from music.predict_rank import predictRank +from music import predictRank # This function now defined in predict_rank.py # diff --git a/pymusic/pyconfig.pxi b/pymusic/pyconfig.pxi new file mode 100644 index 0000000..871d0b9 --- /dev/null +++ b/pymusic/pyconfig.pxi @@ -0,0 +1 @@ +DEF MPI4V2 = True \ No newline at end of file diff --git a/src/application_map.cc b/src/application_map.cc index 515fef7..8c80fb7 100644 --- a/src/application_map.cc +++ b/src/application_map.cc @@ -123,6 +123,7 @@ namespace MUSIC { int size = MPI::COMM_WORLD.Get_size (); int my_rank = MPI::COMM_WORLD.Get_rank (); int *colors = new int[size]; + ApplicationInfo* app = lookup (my_app_label); colors[my_rank] = lookup (my_app_label)->color (); MPI::COMM_WORLD.Allgather (MPI::IN_PLACE, 0, MPI::INT, colors, 1, MPI::INT); diff --git a/src/music/setup.hh b/src/music/setup.hh index 8fb1717..b7fc653 100644 --- a/src/music/setup.hh +++ b/src/music/setup.hh @@ -112,6 +112,8 @@ namespace MUSIC { void init (int& argc, char**& argv); + void init_comm (); + void maybeProcessMusicArgv (int& argc, char**& argv); void maybePostponedSetup (); diff --git a/src/setup.cc b/src/setup.cc index a7945f3..44cc051 100644 --- a/src/setup.cc +++ b/src/setup.cc @@ -19,10 +19,12 @@ #if MUSIC_USE_MPI #include +#include "music/ioutils.hh" #include "music/runtime.hh" #include "music/parse.hh" #include "music/error.hh" #include "music/application_mapper.hh" +#include #include #include @@ -46,7 +48,6 @@ namespace MUSIC { } - Setup::Setup (int& argc, char**& argv, int required, int* provided) : argc_ (argc), argv_ (argv) { @@ -101,8 +102,14 @@ namespace MUSIC { assert(config.length() > 0); launchedByMusic_ = true; if (!config.compare (0, 8, "POSTPONE")) + { postponeSetup_ = true; - config_ = new Configuration (config); + config_ = new Configuration (); + } + else + { + config_ = new Configuration (config); + } } else if (launchedMPMD (argc, argv, config)) { @@ -131,6 +138,23 @@ namespace MUSIC { config_ = new Configuration (); + // Can be moved to configuration.cc or re-written more clean, the current + // form is just for testing + int color; + if (postponeSetup_) + { + std::istringstream env (config); + IOUtils::read (env); + env.ignore(); + /* env.ignore(); */ + env >> color; + } + else + { + color = config_->Color (); + } + + connections_ = new std::vector; // destroyed by runtime if (launchedByMusic ()) { @@ -141,7 +165,9 @@ namespace MUSIC { argc = argc_; argv = argv_; } - comm = MPI::COMM_WORLD.Split (config_->Color (), myRank); + std::cerr << "MUSIC: Comm split color " + << color << " at rank " << myRank << std::endl; + comm = MPI::COMM_WORLD.Split (color, myRank); } else { @@ -263,7 +289,15 @@ namespace MUSIC { if (postponeSetup_) { delete config_; - config_ = new Configuration (); + std::string config (getenv (Configuration::configEnvVarName)); + if (!config.compare (0, 8, "POSTPONE")) + { + std::ostringstream oss; + oss << "MUSIC: : "; + error0 (oss.str ()); + } + std::cout << "Configuration env at this application is " << config << std::endl; + config_ = new Configuration (config); fullInit (); } }