From c4e7c13743a9d1e8dfa5dc27d4b2fa3aaf1557ab Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 15 Dec 2010 21:11:19 +0100 Subject: [PATCH] Cosmetics... * adjust logging format * improve opt::print * check if opt::loba_algo is known --- main.cpp | 6 +++--- named_object_list.h | 2 +- options.cpp | 46 ++++++++++++++++++++++++++------------------- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/main.cpp b/main.cpp index 1b462c2..3ba517c 100644 --- a/main.cpp +++ b/main.cpp @@ -29,7 +29,6 @@ enum { EXIT_FAILURE_CLEAN = 0x08, // error at cleanup }; -#include "loba_simple.h" int simulation_main(int argc, char* argv[]) { int result; @@ -59,6 +58,7 @@ int main(int argc, char* argv[]) // Set default logging parameters // xbt_log_control_set("simu.thres:verbose"); xbt_log_control_set("simu.fmt:'[%h %r] [%c/%p] %m%n'"); + xbt_log_control_set("main.fmt:'[%c/%p] %m%n'"); // Initialize some MSG internal data. // Note: MSG_global_init() may throw an exception, but it seems @@ -104,9 +104,9 @@ int main(int argc, char* argv[]) exit_status = EXIT_FAILURE_SIMU; // ===== // Launch the MSG simulation. - INFO0("Starting simulation..."); + INFO1("Starting simulation at %f...", MSG_get_clock()); res = MSG_main(); - INFO0("Simulation ended."); + INFO1("Simulation ended at %f.", MSG_get_clock()); simulated_time = MSG_get_clock(); if (res != MSG_OK) THROW1(0, 0, "MSG_main() failed with status %#x", res); diff --git a/named_object_list.h b/named_object_list.h index d3fb20c..03bf00d 100644 --- a/named_object_list.h +++ b/named_object_list.h @@ -145,7 +145,7 @@ public: //=================== -#define THIS_INSERT(name, descr, class) insert(name, new creator(descr)) +#define NOL_INSERT(name, descr, class) insert(name, new creator(descr)) #endif // !NAMED_OBJECT_LIST_H diff --git a/options.cpp b/options.cpp index 0a9fb5c..35095a5 100644 --- a/options.cpp +++ b/options.cpp @@ -32,7 +32,7 @@ namespace opt { } // Load balancing algorithm - std::string loba_algo("none"); + std::string loba_algo("simple"); bool bookkeeping = false; // Application parameters @@ -45,18 +45,20 @@ namespace opt { loba_algorithms_type loba_algorithms; loba_algorithms_type::loba_algorithms_type() { - THIS_INSERT("none", "no load-balancing", process); - THIS_INSERT("simple", "balance with least loaded neighbor", - loba_simple); + NOL_INSERT("none", "no load-balancing (for testing)", process); + NOL_INSERT("simple", "balance with least loaded neighbor", loba_simple); } #if 0 topologies_type topologies; topologies_type::topologies_type() { - THIS_INSERT("none", "no load-balancing", process); - THIS_INSERT("simple", "balance with least loaded neighbor", - loba_simple); + NOL_INSERT("line", "line topology, initial load at one end", xxx); + NOL_INSERT("ring", "ring topology", xxx); + NOL_INSERT("star", "star topology, initial load at center", xxx); + NOL_INSERT("clique", "all connected topology", xxx); + NOL_INSERT("btree", "binary tree topologym intiial load at root", xxx); + NOL_INSERT("hcube", "hypercube topology", xxx); } #endif @@ -84,6 +86,11 @@ int opt::parse_args(int* argc, char* argv[]) switch (c) { case 'a': opt::loba_algo = optarg; + if (!opt::loba_algorithms.exists(opt::loba_algo)) { + ERROR1("unknownw load balancing algorithm -- %s", + opt::loba_algo.c_str()); + result = 0; + } break; case 'b': opt::bookkeeping = true; @@ -155,21 +162,22 @@ int opt::parse_args(int* argc, char* argv[]) void opt::print() { INFO0(",----[ Simulation parameters ]"); - INFO1("| platform file.......: \"%s\"", opt::platform_file.c_str()); + INFO1("| log rate.....................: %u", opt::log_rate); + INFO1("| platform file................: \"%s\"", opt::platform_file.c_str()); if (opt::auto_depl::enabled) { - INFO0("| automatic deployment enabled with:"); - INFO1("| topology........: %s", opt::auto_depl::topology.c_str()); - INFO1("| number of hosts.: %u", opt::auto_depl::nhosts); - INFO1("| initial load....: %g", opt::auto_depl::load); + INFO0("| automatic deployment enabled"); + INFO1("| - topology...................: %s", opt::auto_depl::topology.c_str()); + INFO1("| - number of hosts............: %u", opt::auto_depl::nhosts); + INFO1("| - initial load...............: %g", opt::auto_depl::load); } else { - INFO1("| deployment file.....: \"%s\"", opt::deployment_file.c_str()); + INFO1("| deployment file..............: \"%s\"", opt::deployment_file.c_str()); } - INFO1("| log rate............: %u", opt::log_rate); - INFO1("| maxiter.............: %u", opt::maxiter); - INFO1("| exit on close.......: %s", on_off(opt::exit_on_close)); - INFO1("| bookkeeping.........: %s", on_off(opt::bookkeeping)); - INFO1("| comp. cost factors..: [%s]", opt::comp_cost.to_string().c_str()); - INFO1("| comm. cost factors..: [%s]", opt::comm_cost.to_string().c_str()); + INFO1("| load balancing algorithm.....: %s", opt::loba_algo.c_str()); + INFO1("| bookkeeping..................: %s", on_off(opt::bookkeeping)); + INFO1("| computation cost factors.....: [%s]", opt::comp_cost.to_string().c_str()); + INFO1("| communication cost factors...: [%s]", opt::comm_cost.to_string().c_str()); + INFO1("| maximum number of iterations.: %u", opt::maxiter); + INFO1("| exit on close................: %s", on_off(opt::exit_on_close)); INFO0("`----"); } -- 2.39.5