Exemplo n.º 1
0
void surf_config_models_setup(const char *platform_file)
{
  char *workstation_model_name;
  int workstation_id = -1;
  char *network_model_name = NULL;
  char *cpu_model_name = NULL;

  workstation_model_name =
      xbt_cfg_get_string(_surf_cfg_set, "workstation/model");
  network_model_name = xbt_cfg_get_string(_surf_cfg_set, "network/model");
  cpu_model_name = xbt_cfg_get_string(_surf_cfg_set, "cpu/model");

  /* Check whether we use a net/cpu model differing from the default ones, in which case
   * we should switch to the "compound" workstation model to correctly dispatch stuff to
   * the right net/cpu models.
   */
  if ((strcmp(network_model_name, "LV08")
       || strcmp(cpu_model_name, "Cas01"))
      && !strcmp(workstation_model_name, "CLM03")) {
    const char *val = "compound";
    XBT_INFO
        ("Switching workstation model to compound since you changed the network and/or cpu model(s)");
    xbt_cfg_set_string(_surf_cfg_set, "workstation/model", val);
    workstation_model_name = (char *) "compound";
  }

  XBT_DEBUG("Workstation model: %s", workstation_model_name);
  workstation_id =
      find_model_description(surf_workstation_model_description,
                             workstation_model_name);
  if (!strcmp(workstation_model_name, "compound")) {
    int network_id = -1;
    int cpu_id = -1;

    xbt_assert(cpu_model_name,
                "Set a cpu model to use with the 'compound' workstation model");

    xbt_assert(network_model_name,
                "Set a network model to use with the 'compound' workstation model");

    network_id =
        find_model_description(surf_network_model_description,
                               network_model_name);
    cpu_id =
        find_model_description(surf_cpu_model_description, cpu_model_name);

    surf_cpu_model_description[cpu_id].model_init_preparse(platform_file);
    surf_network_model_description[network_id].model_init_preparse
        (platform_file);
  }

  XBT_DEBUG("Call workstation_model_init");
  surf_workstation_model_description[workstation_id].model_init_preparse
      (platform_file);
}
Exemplo n.º 2
0
CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel()
{
  char *optim = xbt_cfg_get_string("cpu/optim");
  bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update");

  if (!strcmp(optim, "Full")) {
    updateMechanism_ = UM_FULL;
    selectiveUpdate_ = select;
  } else if (!strcmp(optim, "Lazy")) {
    updateMechanism_ = UM_LAZY;
    selectiveUpdate_ = true;
    xbt_assert(select || (xbt_cfg_is_default_value("cpu/maxmin-selective-update")),
               "Disabling selective update while using the lazy update mechanism is dumb!");
  } else {
    xbt_die("Unsupported optimization (%s) for this model", optim);
  }

  p_cpuRunningActionSetThatDoesNotNeedBeingChecked = new ActionList();
  maxminSystem_ = lmm_system_new(selectiveUpdate_);

  if (getUpdateMechanism() == UM_LAZY) {
    actionHeap_ = xbt_heap_new(8, nullptr);
    xbt_heap_set_update_callback(actionHeap_,  surf_action_lmm_update_index_heap);
    modifiedSet_ = new ActionLmmList();
    maxminSystem_->keep_track = modifiedSet_;
  }
}
Exemplo n.º 3
0
void _mc_cfg_cb_dot_output(const char *name)
{
  if (_sg_cfg_init_status && !_sg_do_model_check)
    xbt_die
        ("You are specifying a file name for a dot output of graph state after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");

  _sg_mc_dot_output_file = xbt_cfg_get_string(name);
}
Exemplo n.º 4
0
/* callback of the cpu/model variable */
static void _sg_cfg_cb__storage_mode(const char *name)
{
  xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");

  char *val = xbt_cfg_get_string(name);
  if (!strcmp(val, "help")) {
    model_help("storage", surf_storage_model_description);
    sg_cfg_exit_early();
  }

  find_model_description(surf_storage_model_description, val);
}
Exemplo n.º 5
0
void surf_config_models_create_elms(void)
{
  char *workstation_model_name =
      xbt_cfg_get_string(_surf_cfg_set, "workstation/model");
  int workstation_id =
      find_model_description(surf_workstation_model_description,
                             workstation_model_name);
  if (surf_workstation_model_description
      [workstation_id].model_init_postparse != NULL)
    surf_workstation_model_description[workstation_id].model_init_postparse
        ();
}
Exemplo n.º 6
0
/* callback of the network_model variable */
static void _sg_cfg_cb__network_model(const char *name)
{
  xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");

  char *val = xbt_cfg_get_string(name);
  if (!strcmp(val, "help")) {
    model_help("network", surf_network_model_description);
    sg_cfg_exit_early();
  }

  /* New Module missing */
  find_model_description(surf_network_model_description, val);
}
Exemplo n.º 7
0
/* callback of the vm/model variable */
static void _sg_cfg_cb__vm_model(const char *name)
{
  xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");

  char *val = xbt_cfg_get_string(name);
  if (!strcmp(val, "help")) {
    model_help("vm", surf_vm_model_description);
    sg_cfg_exit_early();
  }

  /* Make sure that the model exists */
  find_model_description(surf_vm_model_description, val);
}
Exemplo n.º 8
0
/* callback of the mpi collectives: simply check that this is a valid name. It will be picked up in smpi_global.cpp */
static void _check_coll(const char *category,
                             s_mpi_coll_description_t * table,
                             const char *name)
{
  xbt_assert(_sg_cfg_init_status < 2, "Cannot change the collective algorithm after the initialization");

  char *val = xbt_cfg_get_string(name);
  if (val && !strcmp(val, "help")) {
    coll_help(category, table);
    sg_cfg_exit_early();
  }

  find_coll_description(table, val, category);
}
Exemplo n.º 9
0
int TRACE_start()
{
  if (TRACE_is_configured())
    TRACE_getopts();

  // tracing system must be:
  //    - enabled (with --cfg=tracing:yes)
  //    - already configured (TRACE_global_init already called)
  if (TRACE_is_enabled()) {

    XBT_DEBUG("Tracing starts");
    /* init the tracing module to generate the right output */
    /* open internal buffer */
    TRACE_init();

    /* open the trace file(s) */
    const char* format = xbt_cfg_get_string(OPT_TRACING_FORMAT);
    XBT_DEBUG("Tracing format %s\n", format);
    if(!strcmp(format, "Paje")){
      TRACE_paje_init();
      TRACE_paje_start();
    }else if (!strcmp(format, "TI")){
      TRACE_TI_init();
      TRACE_TI_start();
    }else{
      xbt_die("Unknown trace format :%s ", format);
    }

    /* activate trace */
    if (trace_active == 1) {
      THROWF(tracing_error, 0, "Tracing is already active");
    }
    trace_active = 1;
    XBT_DEBUG("Tracing is on");

    /* other trace initialization */
    created_categories = xbt_dict_new_homogeneous(xbt_free_f);
    declared_marks = xbt_dict_new_homogeneous(xbt_free_f);
    user_host_variables = xbt_dict_new_homogeneous(xbt_free_f);
    user_vm_variables = xbt_dict_new_homogeneous(xbt_free_f);
    user_link_variables = xbt_dict_new_homogeneous(xbt_free_f);

    if (TRACE_start_functions != NULL) {
      void (*func) ();
      unsigned int iter;
      xbt_dynar_foreach(TRACE_start_functions, iter, func) {
        func();
      }
    }
  }
Exemplo n.º 10
0
void _mc_cfg_cb_reduce(const char *name)
{
  if (_sg_cfg_init_status && !_sg_do_model_check)
    xbt_die
        ("You are specifying a reduction strategy after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");

  char *val = xbt_cfg_get_string(name);
  if (!strcasecmp(val, "none"))
    simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::none;
  else if (!strcasecmp(val, "dpor"))
    simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::dpor;
  else
    xbt_die("configuration option %s can only take 'none' or 'dpor' as a value",
            name);
}
Exemplo n.º 11
0
/* callback of the plugin variable */
static void _sg_cfg_cb__plugin(const char *name)
{
  xbt_assert(_sg_cfg_init_status < 2, "Cannot load a plugin after the initialization");

  char *val = xbt_cfg_get_string(name);
  if (val==nullptr || val[0] == '\0')
    return;

  if (!strcmp(val, "help")) {
    model_help("plugin", surf_plugin_description);
    sg_cfg_exit_early();
  }

  int plugin_id = find_model_description(surf_plugin_description, val);
  surf_plugin_description[plugin_id].model_init_preparse();
}
Exemplo n.º 12
0
static void _surf_cfg_cb__surf_network_coordinates(const char *name,
        int pos)
{
    char *val = xbt_cfg_get_string(_surf_cfg_set, name);
    if (!strcmp(val, "yes")) {
        if (!COORD_HOST_LEVEL) {
            COORD_HOST_LEVEL = xbt_lib_add_level(host_lib,xbt_dynar_free_voidp);
            COORD_ASR_LEVEL  = xbt_lib_add_level(as_router_lib,xbt_dynar_free_voidp);
        }
    } else if (!strcmp(val, "no")) {
        if (COORD_HOST_LEVEL)
            xbt_die("Setting of whether to use coordinate cannot be disabled once set.");
    } else {
        xbt_die("Command line setting of whether to use coordinates must be either \"yes\" or \"no\"");
    }
}
Exemplo n.º 13
0
double NetworkSmpiModel::latencyFactor(double size)
{
    if (smpi_lat_factor.empty())
        smpi_lat_factor = parse_factor(xbt_cfg_get_string("smpi/lat-factor"));

    double current=1.0;
    for (auto fact: smpi_lat_factor) {
        if (size <= fact.factor) {
            XBT_DEBUG("%f <= %zu return %f", size, fact.factor, current);
            return current;
        } else
            current=fact.values.front();
    }
    XBT_DEBUG("%f > %zu return %f", size, smpi_lat_factor.back().factor, current);

    return current;
}
Exemplo n.º 14
0
/* callback of the workstation/model variable */
static void _sg_cfg_cb__workstation_model(const char *name, int pos)
{
  char *val;

  xbt_assert(_sg_init_status == 1,
              "Cannot change the model after the initialization");

  val = xbt_cfg_get_string(_sg_cfg_set, name);

  if (!strcmp(val, "help")) {
    model_help("workstation", surf_workstation_model_description);
    exit(0);
  }

  /* Make sure that the model exists */
  find_model_description(surf_workstation_model_description, val);
}
Exemplo n.º 15
0
/* callback of the workstation_model variable */
static void _sg_cfg_cb__network_model(const char *name, int pos)
{
  char *val;

  xbt_assert(_sg_init_status == 1,
              "Cannot change the model after the initialization");

  val = xbt_cfg_get_string(_sg_cfg_set, name);

  if (!strcmp(val, "help")) {
    model_help("network", surf_network_model_description);
    exit(0);
  }

  /* New Module missing */
  find_model_description(surf_network_model_description, val);
}
Exemplo n.º 16
0
/* callback of the cpu/model variable */
static void _sg_cfg_cb__storage_mode(const char *name, int pos)
{
  char *val;

  xbt_assert(_sg_cfg_init_status < 2,
              "Cannot change the model after the initialization");

  val = xbt_cfg_get_string(_sg_cfg_set, name);

  if (!strcmp(val, "help")) {
    model_help("storage", surf_storage_model_description);
    sg_cfg_exit_early();
  }

  /* New Module missing */
  find_model_description(surf_storage_model_description, val);
}
Exemplo n.º 17
0
static void _sg_cfg_cb_contexts_parallel_mode(const char *name, int pos)
{
  const char* mode_name = xbt_cfg_get_string(_sg_cfg_set, name);
  if (!strcmp(mode_name, "posix")) {
    SIMIX_context_set_parallel_mode(XBT_PARMAP_POSIX);
  }
  else if (!strcmp(mode_name, "futex")) {
    SIMIX_context_set_parallel_mode(XBT_PARMAP_FUTEX);
  }
  else if (!strcmp(mode_name, "busy_wait")) {
    SIMIX_context_set_parallel_mode(XBT_PARMAP_BUSY_WAIT);
  }
  else {
    xbt_die("Command line setting of the parallel synchronization mode should "
            "be one of \"posix\", \"futex\" or \"busy_wait\"");
  }
}
Exemplo n.º 18
0
/*********
 * Model *
 *********/
void surf_cpu_model_init_Cas01()
{
  xbt_assert(!surf_cpu_model_pm);
  xbt_assert(!surf_cpu_model_vm);

  char *optim = xbt_cfg_get_string("cpu/optim");
  if (!strcmp(optim, "TI")) {
    surf_cpu_model_init_ti();
    return;
  }

  surf_cpu_model_pm = new simgrid::surf::CpuCas01Model();
  all_existing_models->push_back(surf_cpu_model_pm);

  surf_cpu_model_vm  = new simgrid::surf::CpuCas01Model();
  all_existing_models->push_back(surf_cpu_model_vm);
}
Exemplo n.º 19
0
/* callback of the mpi collectives */
static void _sg_cfg_cb__coll(const char *category,
                             s_mpi_coll_description_t * table,
                             const char *name, int pos)
{
  char *val;

  xbt_assert(_sg_cfg_init_status < 2,
              "Cannot change the model after the initialization");

  val = xbt_cfg_get_string(_sg_cfg_set, name);

  if (!strcmp(val, "help")) {
    coll_help(category, table);
    sg_cfg_exit_early();
  }

  /* New Module missing */
  find_coll_description(table, val, category);
}
Exemplo n.º 20
0
CpuCas01Model::CpuCas01Model() : CpuModel("cpu")
{
  char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim");
  int select = xbt_cfg_get_boolean(_sg_cfg_set, "cpu/maxmin_selective_update");

  if (!strcmp(optim, "Full")) {
    p_updateMechanism = UM_FULL;
    m_selectiveUpdate = select;
  } else if (!strcmp(optim, "Lazy")) {
    p_updateMechanism = UM_LAZY;
    m_selectiveUpdate = 1;
    xbt_assert((select == 1)
               ||
               (xbt_cfg_is_default_value
                (_sg_cfg_set, "cpu/maxmin_selective_update")),
               "Disabling selective update while using the lazy update mechanism is dumb!");
  } else {
    xbt_die("Unsupported optimization (%s) for this model", optim);
  }

  p_cpuRunningActionSetThatDoesNotNeedBeingChecked = new ActionList();

  if (getUpdateMechanism() == UM_LAZY) {
	shareResources = &CpuCas01Model::shareResourcesLazy;
	updateActionsState = &CpuCas01Model::updateActionsStateLazy;

  } else if (getUpdateMechanism() == UM_FULL) {
	shareResources = &CpuCas01Model::shareResourcesFull;
	updateActionsState = &CpuCas01Model::updateActionsStateFull;
  } else
    xbt_die("Invalid cpu update mechanism!");

  if (!p_maxminSystem) {
    p_maxminSystem = lmm_system_new(m_selectiveUpdate);
  }

  if (getUpdateMechanism() == UM_LAZY) {
    p_actionHeap = xbt_heap_new(8, NULL);
    xbt_heap_set_update_callback(p_actionHeap,  surf_action_lmm_update_index_heap);
    p_modifiedSet = new ActionLmmList();
    p_maxminSystem->keep_track = p_modifiedSet;
  }
}
Exemplo n.º 21
0
/* callback of the plugin variable */
static void _sg_cfg_cb__plugin(const char *name, int pos)
{
  char *val;

  XBT_VERB("PLUGIN");
  xbt_assert(_sg_cfg_init_status < 2,
              "Cannot load a plugin after the initialization");

  val = xbt_cfg_get_string(_sg_cfg_set, name);

  if (!strcmp(val, "help")) {
    model_help("plugin", surf_plugin_description);
    sg_cfg_exit_early();
  }

  /* New Module missing */
  int plugin_id = find_model_description(surf_plugin_description, val);
  surf_plugin_description[plugin_id].model_init_preparse();
}
Exemplo n.º 22
0
/*********
 * Model *
 *********/
void surf_cpu_model_init_Cas01()
{
  char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim");

  xbt_assert(!surf_cpu_model_pm);
  xbt_assert(!surf_cpu_model_vm);

  if (!strcmp(optim, "TI")) {
    surf_cpu_model_init_ti();
    return;
  }

  surf_cpu_model_pm = new CpuCas01Model();
  surf_cpu_model_vm  = new CpuCas01Model();

  cpu_define_callbacks();
  ModelPtr model_pm = surf_cpu_model_pm;
  ModelPtr model_vm = surf_cpu_model_vm;
  xbt_dynar_push(model_list, &model_pm);
  xbt_dynar_push(model_list, &model_vm);
}
Exemplo n.º 23
0
void NetworkCm02Model::initialize()
{
  char *optim = xbt_cfg_get_string(_sg_cfg_set, "network/optim");
  int select =
      xbt_cfg_get_boolean(_sg_cfg_set, "network/maxmin_selective_update");

  if (!strcmp(optim, "Full")) {
    p_updateMechanism = UM_FULL;
    m_selectiveUpdate = select;
  } else if (!strcmp(optim, "Lazy")) {
    p_updateMechanism = UM_LAZY;
    m_selectiveUpdate = 1;
    xbt_assert((select == 1)
               ||
               (xbt_cfg_is_default_value
                (_sg_cfg_set, "network/maxmin_selective_update")),
               "Disabling selective update while using the lazy update mechanism is dumb!");
  } else {
    xbt_die("Unsupported optimization (%s) for this model", optim);
  }

  if (!p_maxminSystem)
	p_maxminSystem = lmm_system_new(m_selectiveUpdate);

  const char* lb_name = "__loopback__";
  routing_model_create(createNetworkLink(lb_name,
	                                           498000000, NULL, 0.000015, NULL,
	                                           SURF_RESOURCE_ON, NULL,
	                                           SURF_LINK_FATPIPE, NULL));

  if (p_updateMechanism == UM_LAZY) {
	p_actionHeap = xbt_heap_new(8, NULL);
	xbt_heap_set_update_callback(p_actionHeap, surf_action_lmm_update_index_heap);
	p_modifiedSet = new ActionLmmList();
	p_maxminSystem->keep_track = p_modifiedSet;
  }

  m_haveGap = false;
}
Exemplo n.º 24
0
char *TRACE_get_viva_cat_conf (void)
{
  return xbt_cfg_get_string(_surf_cfg_set, OPT_VIVA_CAT_CONF);
}
Exemplo n.º 25
0
char *TRACE_get_filename(void)
{
  return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_FILENAME);
}
Exemplo n.º 26
0
char *TRACE_get_comment_file (void)
{
  return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_COMMENT_FILE);
}
Exemplo n.º 27
0
static void _sg_cfg_cb_context_factory(const char *name, int pos)
{
  smx_context_factory_name = xbt_cfg_get_string(_sg_cfg_set, name);
}
Exemplo n.º 28
0
static void _sg_cfg_cb_model_check_replay(const char *name, int pos)
{
  MC_record_path = xbt_cfg_get_string(_sg_cfg_set, name);
}
Exemplo n.º 29
0
char* sg_cfg_get_string(const char* name)
{
  return xbt_cfg_get_string(_sg_cfg_set, name);
}
Exemplo n.º 30
0
/* Pick the right models for CPU, net and host, and call their model_init_preparse */
void surf_config_models_setup()
{
  const char *host_model_name;
  const char *vm_model_name;
  int host_id = -1;
  int vm_id = -1;
  char *network_model_name = NULL;
  char *cpu_model_name = NULL;
  int storage_id = -1;
  char *storage_model_name = NULL;

  host_model_name = xbt_cfg_get_string(_sg_cfg_set, "host/model");
  vm_model_name = xbt_cfg_get_string(_sg_cfg_set, "vm/model");
  network_model_name = xbt_cfg_get_string(_sg_cfg_set, "network/model");
  cpu_model_name = xbt_cfg_get_string(_sg_cfg_set, "cpu/model");
  storage_model_name = xbt_cfg_get_string(_sg_cfg_set, "storage/model");

  /* Check whether we use a net/cpu model differing from the default ones, in which case
   * we should switch to the "compound" host model to correctly dispatch stuff to
   * the right net/cpu models.
   */

  if ((!xbt_cfg_is_default_value(_sg_cfg_set, "network/model") ||
       !xbt_cfg_is_default_value(_sg_cfg_set, "cpu/model")) &&
      xbt_cfg_is_default_value(_sg_cfg_set, "host/model")) {
    host_model_name = "compound";
    xbt_cfg_set_string(_sg_cfg_set, "host/model", host_model_name);
  }

  XBT_DEBUG("host model: %s", host_model_name);
  host_id = find_model_description(surf_host_model_description, host_model_name);
  if (!strcmp(host_model_name, "compound")) {
    int network_id = -1;
    int cpu_id = -1;

    xbt_assert(cpu_model_name,
                "Set a cpu model to use with the 'compound' host model");

    xbt_assert(network_model_name,
                "Set a network model to use with the 'compound' host model");

    if(surf_cpu_model_init_preparse){
      surf_cpu_model_init_preparse();
    } else {
      cpu_id =
          find_model_description(surf_cpu_model_description, cpu_model_name);
      surf_cpu_model_description[cpu_id].model_init_preparse();
    }

    network_id =
        find_model_description(surf_network_model_description,
                               network_model_name);
    surf_network_model_description[network_id].model_init_preparse();
  }

  XBT_DEBUG("Call host_model_init");
  surf_host_model_description[host_id].model_init_preparse();

  XBT_DEBUG("Call vm_model_init");
  vm_id = find_model_description(surf_vm_model_description, vm_model_name);
  surf_vm_model_description[vm_id].model_init_preparse();

  XBT_DEBUG("Call storage_model_init");
  storage_id = find_model_description(surf_storage_model_description, storage_model_name);
  surf_storage_model_description[storage_id].model_init_preparse();

}