#include "instr/instr_interface.h"
#include "simgrid/simix.h"
#include "simgrid/sg_config.h"
-#ifdef HAVE_SMPI
+#include "simgrid_config.h" /* what was compiled in? */
+#if HAVE_SMPI
#include "smpi/smpi_interface.h"
#endif
#include "mc/mc.h"
#include "simgrid/instr.h"
#include "src/mc/mc_replay.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf,
- "About the configuration of SimGrid");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf, "About the configuration of SimGrid");
xbt_cfg_t _sg_cfg_set = NULL;
sg_weight_S_parameter = xbt_cfg_get_double(_sg_cfg_set, name);
}
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
/* callback of the mpi collectives */
static void _sg_cfg_cb__coll(const char *category,
s_mpi_coll_description_t * table,
/* callback to decide if we want to use the model-checking */
#include "src/xbt_modinter.h"
-#ifdef HAVE_MC
+#if HAVE_MC
extern int _sg_do_model_check; /* this variable lives in xbt_main until I find a right location for it */
extern int _sg_do_model_check_record;
#endif
MC_record_path = xbt_cfg_get_string(_sg_cfg_set, name);
}
-#ifdef HAVE_MC
+#if HAVE_MC
static void _sg_cfg_cb_model_check_record(const char *name, int pos) {
_sg_do_model_check_record = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
xbt_cfg_register(&_sg_cfg_set, "model-check/replay",
"Enable replay mode with the given path", xbt_cfgelm_string, 0, 1, _sg_cfg_cb_model_check_replay);
-#ifdef HAVE_MC
+#if HAVE_MC
/* do model-checking-record */
xbt_cfg_register(&_sg_cfg_set, "model-check/record",
"Record the model-checking paths",
sprintf(description,
"Context factory to use in SIMIX. Possible values: %s",
dflt_ctx_fact);
-#ifdef HAVE_UCONTEXT_CONTEXTS
+#if HAVE_UCONTEXT_CONTEXTS
dflt_ctx_fact = "ucontext";
p += sprintf(p, ", %s", dflt_ctx_fact);
#endif
-#ifdef HAVE_RAW_CONTEXTS
+#if HAVE_RAW_CONTEXTS
dflt_ctx_fact = "raw";
p += sprintf(p, ", %s", dflt_ctx_fact);
#endif
xbt_cfg_register(&_sg_cfg_set, "contexts/guard_size",
"Guard size for contexts stacks in memory pages",
xbt_cfgelm_int, 1, 1, _sg_cfg_cb_context_guard_size);
-#if defined(_XBT_WIN32) || (PTH_STACKGROWTH != -1)
+#if defined(_WIN32) || (PTH_STACKGROWTH != -1)
xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/guard_size", 0);
#else
xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/guard_size", 1);
xbt_cfg_register(&_sg_cfg_set, "contexts/synchro",
"Synchronization mode to use when running contexts in parallel (either futex, posix or busy_wait)",
xbt_cfgelm_string, 1, 1, _sg_cfg_cb_contexts_parallel_mode);
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/synchro", "futex");
#else //No futex on mac and posix is unimplememted yet
xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/synchro", "busy_wait");
xbt_cfg_register(&_sg_cfg_set, "network/crosstraffic",
"Activate the interferences between uploads and downloads for fluid max-min models (LV08, CM02)",
xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb__surf_network_crosstraffic);
- xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "no");
+ xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "yes");
-#ifdef HAVE_NS3
+#if HAVE_NS3
xbt_cfg_register(&_sg_cfg_set, "ns3/TcpModel",
"The ns3 tcp model can be : NewReno or Reno or Tahoe",
xbt_cfgelm_string, 1, 1, NULL);
//test is if( size >= thresholdN ) return valueN;
//Values can be modified with command line --cfg=smpi/bw_factor:"threshold0:value0;threshold1:value1;...;thresholdN:valueN"
// or with tag config put line <prop id="smpi/bw_factor" value="threshold0:value0;threshold1:value1;...;thresholdN:valueN"></prop>
- // SMPI model can be used without enable_smpi, so keep this the ifdef.
+ // SMPI model can be used without enable_smpi, so keep this out of the ifdef.
xbt_cfg_register(&_sg_cfg_set, "smpi/bw_factor",
"Bandwidth factors for smpi.",
xbt_cfgelm_string, 1, 1, NULL);
xbt_cfgelm_string, 1, 1, NULL);
xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/IB_penalty_factors", "0.965;0.925;1.35");
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
xbt_cfg_register(&_sg_cfg_set, "smpi/running_power",
"Power of the host running the simulation (in flop/s). Used to bench the operations.",
xbt_cfgelm_double, 1, 1, NULL);
sg_config_cmd_line(argc, argv);
xbt_mallocator_initialization_is_done(SIMIX_context_is_parallel());
-
} else {
XBT_WARN("Call to sg_config_init() after initialization ignored");
}
_sg_cfg_init_status = 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();
-
-}
-
int sg_cfg_is_default_value(const char *name)
{
return xbt_cfg_is_default_value(_sg_cfg_set, name);