Ejemplo n.º 1
0
static void _sg_cfg_cb_model_check_record(const char *name, int pos)
{
#ifdef HAVE_MC
  _sg_do_model_check_record = xbt_cfg_get_boolean(_sg_cfg_set, name);
#else
  if (xbt_cfg_get_boolean(_sg_cfg_set, name)) {
    xbt_die("You tried to activate the model-checking record from the command line, but it was not compiled in. Change your settings in cmake, recompile and try again");
  }
#endif
}
Ejemplo n.º 2
0
void print_TICreateContainer(paje_event_t event)
{
  //if we are in the mode with only one file
  static FILE *temp = nullptr;

  if (tracing_files == nullptr) {
    tracing_files = xbt_dict_new_homogeneous(nullptr);
    //generate unique run id with time
    prefix = xbt_os_time();
  }

  if (!xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || temp == nullptr) {
    char *folder_name = bprintf("%s_files", TRACE_get_filename());
    char *filename = bprintf("%s/%f_%s.txt", folder_name, prefix, ((createContainer_t) event->data)->container->name);
#ifdef WIN32
    _mkdir(folder_name);
#else
    mkdir(folder_name, S_IRWXU | S_IRWXG | S_IRWXO);
#endif
    temp = fopen(filename, "w");
    xbt_assert(temp, "Tracefile %s could not be opened for writing: %s", filename, strerror(errno));
    fprintf(tracing_file, "%s\n", filename);

    xbt_free(folder_name);
    xbt_free(filename);
  }

  xbt_dict_set(tracing_files, ((createContainer_t) event->data)->container->name, (void *) temp, nullptr);
}
Ejemplo n.º 3
0
void _mc_cfg_cb_ksm(const char *name)
{
  if (_sg_cfg_init_status && !_sg_do_model_check)
    xbt_die("You are specifying a KSM value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry.");

  _sg_mc_ksm = xbt_cfg_get_boolean(name);
}
Ejemplo n.º 4
0
void new_pajePushStateWithExtra (double timestamp, container_t container, type_t type, val_t value, void* extra)
{
  paje_event_t event = xbt_new0(s_paje_event_t, 1);
  event->event_type = PAJE_PushState;
  event->timestamp = timestamp;
  event->print = active_writer.print_PushState;
  event->free                             = &free_paje_event;
  event->data = xbt_new0(s_pushState_t, 1);
  (static_cast<pushState_t>(event->data))->type = type;
  (static_cast<pushState_t>(event->data))->container = container;
  (static_cast<pushState_t>(event->data))->value = value;
  (static_cast<pushState_t>(event->data))->extra = extra;

#if HAVE_SMPI
  if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
    smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
    (static_cast<pushState_t>(event->data))->filename   = loc->filename;
    (static_cast<pushState_t>(event->data))->linenumber = loc->linenumber;
  }
#endif

  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, static_cast<int>(event->event_type), event->timestamp);

  insert_into_buffer (event);
}
Ejemplo n.º 5
0
void _mc_cfg_cb_timeout(const char *name)
{
  if (_sg_cfg_init_status && !(_sg_do_model_check || MC_record_path))
    xbt_die("You are specifying a value to enable/disable timeout for wait requests 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_timeout = xbt_cfg_get_boolean(name);
}
Ejemplo n.º 6
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_;
  }
}
Ejemplo n.º 7
0
static void smpi_init_options(){
  int gather_id = find_coll_description(mpi_coll_gather_description, xbt_cfg_get_string("smpi/gather"),"gather");
    mpi_coll_gather_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, int, MPI_Comm))
        mpi_coll_gather_description[gather_id].coll;

    int allgather_id = find_coll_description(mpi_coll_allgather_description,
                                             xbt_cfg_get_string("smpi/allgather"),"allgather");
    mpi_coll_allgather_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm))
        mpi_coll_allgather_description[allgather_id].coll;

    int allgatherv_id = find_coll_description(mpi_coll_allgatherv_description,
                                              xbt_cfg_get_string("smpi/allgatherv"),"allgatherv");
    mpi_coll_allgatherv_fun = (int (*)(void *, int, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm))
        mpi_coll_allgatherv_description[allgatherv_id].coll;

    int allreduce_id = find_coll_description(mpi_coll_allreduce_description,
                                             xbt_cfg_get_string("smpi/allreduce"),"allreduce");
    mpi_coll_allreduce_fun = (int (*)(void *sbuf, void *rbuf, int rcount, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm))
        mpi_coll_allreduce_description[allreduce_id].coll;

    int alltoall_id = find_coll_description(mpi_coll_alltoall_description,
                                            xbt_cfg_get_string("smpi/alltoall"),"alltoall");
    mpi_coll_alltoall_fun = (int (*)(void *, int, MPI_Datatype, void *, int, MPI_Datatype, MPI_Comm))
        mpi_coll_alltoall_description[alltoall_id].coll;

    int alltoallv_id = find_coll_description(mpi_coll_alltoallv_description,
                                             xbt_cfg_get_string("smpi/alltoallv"),"alltoallv");
    mpi_coll_alltoallv_fun = (int (*)(void *, int *, int *, MPI_Datatype, void *, int *, int *, MPI_Datatype, MPI_Comm))
        mpi_coll_alltoallv_description[alltoallv_id].coll;

    int bcast_id = find_coll_description(mpi_coll_bcast_description, xbt_cfg_get_string("smpi/bcast"),"bcast");
    mpi_coll_bcast_fun = (int (*)(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm com))
        mpi_coll_bcast_description[bcast_id].coll;

    int reduce_id = find_coll_description(mpi_coll_reduce_description, xbt_cfg_get_string("smpi/reduce"),"reduce");
    mpi_coll_reduce_fun = (int (*)(void *buf, void *rbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
                                    MPI_Comm comm)) mpi_coll_reduce_description[reduce_id].coll;

    int reduce_scatter_id =
        find_coll_description(mpi_coll_reduce_scatter_description,
                              xbt_cfg_get_string("smpi/reduce-scatter"),"reduce_scatter");
    mpi_coll_reduce_scatter_fun = (int (*)(void *sbuf, void *rbuf, int *rcounts,MPI_Datatype dtype, MPI_Op op,
                                           MPI_Comm comm)) mpi_coll_reduce_scatter_description[reduce_scatter_id].coll;

    int scatter_id = find_coll_description(mpi_coll_scatter_description, xbt_cfg_get_string("smpi/scatter"),"scatter");
    mpi_coll_scatter_fun = (int (*)(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
                                    int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm))
        mpi_coll_scatter_description[scatter_id].coll;

    int barrier_id = find_coll_description(mpi_coll_barrier_description, xbt_cfg_get_string("smpi/barrier"),"barrier");
    mpi_coll_barrier_fun = (int (*)(MPI_Comm comm)) mpi_coll_barrier_description[barrier_id].coll;

    smpi_coll_cleanup_callback=NULL;
    smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu-threshold");
    smpi_running_power = xbt_cfg_get_double("smpi/running-power");
    smpi_privatize_global_variables = xbt_cfg_get_boolean("smpi/privatize-global-variables");
    if (smpi_cpu_threshold < 0)
      smpi_cpu_threshold = DBL_MAX;
}
Ejemplo n.º 8
0
void _mc_cfg_cb_hash(const char *name)
{
  if (_sg_cfg_init_status && !_sg_do_model_check)
    xbt_die
        ("You are specifying a value to enable/disable the use of global hash to speedup state comparaison, 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_hash = xbt_cfg_get_boolean(name);
}
Ejemplo n.º 9
0
void print_TIDestroyContainer(paje_event_t event)
{
  if (!xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file")|| xbt_dict_length(tracing_files) == 1) {
    FILE* f = (FILE*)xbt_dict_get_or_null(tracing_files, ((destroyContainer_t) event->data)->container->name);
    fclose(f);
  }
  xbt_dict_remove(tracing_files, ((destroyContainer_t) event->data)->container->name);
}
Ejemplo n.º 10
0
void _mc_cfg_cb_termination(const char *name)
{
  if (_sg_cfg_init_status && !_sg_do_model_check)
    xbt_die
        ("You are specifying a value to enable/disable the detection of non progressive cycles 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_termination = xbt_cfg_get_boolean(name);
}
Ejemplo n.º 11
0
void _mc_cfg_cb_snapshot_fds(const char *name)
{
  if (_sg_cfg_init_status && !_sg_do_model_check)
    xbt_die
        ("You are specifying a value to enable/disable the use of FD snapshotting, 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_snapshot_fds = xbt_cfg_get_boolean(name);
}
Ejemplo n.º 12
0
Session::Session(pid_t pid, int socket)
{
  std::unique_ptr<simgrid::mc::Process> process(new simgrid::mc::Process(pid, socket));
  // TODO, automatic detection of the config from the process
  process->privatized(
    xbt_cfg_get_boolean("smpi/privatize-global-variables"));
  modelChecker_ = std::unique_ptr<ModelChecker>(
    new simgrid::mc::ModelChecker(std::move(process)));
  xbt_assert(mc_model_checker == nullptr);
  mc_model_checker = modelChecker_.get();
  mc_model_checker->start();
}
Ejemplo n.º 13
0
static void _sg_cfg_cb__surf_network_coordinates(const char *name,
                                                 int pos)
{
  int val = xbt_cfg_get_boolean(_sg_cfg_set, name);
  if (val) {
    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 (COORD_HOST_LEVEL)
      xbt_die("Setting of whether to use coordinate cannot be disabled once set.");
}
Ejemplo n.º 14
0
static void _sg_cfg_cb__surf_network_coordinates(const char *name)
{
  static int already_set = 0;
  int val = xbt_cfg_get_boolean(name);
  if (val) {
    if (!already_set) {
      COORD_HOST_LEVEL = sg_host_extension_create(xbt_dynar_free_voidp);
      COORD_ASR_LEVEL  = xbt_lib_add_level(as_router_lib,xbt_dynar_free_voidp);
    }
    already_set = 1;
  } else
    if (already_set)
      xbt_die("Setting of whether to use coordinate cannot be disabled once set.");
}
Ejemplo n.º 15
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;
  }
}
Ejemplo n.º 16
0
/**
 * \ingroup msg_simulation
 * \brief Initialize MSG with less verifications
 * You should use the MSG_init() function instead. Failing to do so may turn into PEBKAC some day. You've been warned.
 */
void MSG_init_nocheck(int *argc, char **argv) {

  TRACE_global_init(argc, argv);

  xbt_getpid = MSG_process_self_PID;
  if (!msg_global) {

    msg_global = xbt_new0(s_MSG_Global_t, 1);

    xbt_cfg_register_boolean("msg/debug-multiple-use", "no", _sg_cfg_cb_msg_debug_multiple_use,
        "Print backtraces of both processes when there is a conflict of multiple use of a task");

    SIMIX_global_init(argc, argv);

    msg_global->sent_msg = 0;
    msg_global->task_copy_callback = nullptr;
    msg_global->process_data_cleanup = nullptr;

    SIMIX_function_register_process_create(MSG_process_create_from_SIMIX);
    SIMIX_function_register_process_cleanup(MSG_process_cleanup_from_SIMIX);

    simgrid::surf::on_postparse.connect(MSG_post_create_environment);
    simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) {
      MSG_host_create_(&host);
    });
    MSG_HOST_LEVEL = simgrid::s4u::Host::extension_create([](void *p) {
      __MSG_host_priv_free((msg_host_priv_t) p);
    });

  }

  if(MC_is_active()){
    /* Ignore total amount of messages sent during the simulation for heap comparison */
    MC_ignore_heap(&(msg_global->sent_msg), sizeof(msg_global->sent_msg));
  }

  XBT_DEBUG("ADD MSG LEVELS");
  MSG_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, (void_f_pvoid_t) __MSG_storage_destroy);
  MSG_FILE_LEVEL = xbt_lib_add_level(file_lib, (void_f_pvoid_t) __MSG_file_destroy);
  if(xbt_cfg_get_boolean("clean-atexit"))
    atexit(MSG_exit);
}
Ejemplo n.º 17
0
static void TRACE_header_PajePushState (int size)
{
  fprintf(tracing_file, "%%EventDef PajePushState %d\n", PAJE_PushState);
  fprintf(tracing_file, "%%       Time date\n");
  fprintf(tracing_file, "%%       Type string\n");
  fprintf(tracing_file, "%%       Container string\n");
  fprintf(tracing_file, "%%       Value string\n");
  if (size) fprintf(tracing_file, "%%       Size int\n");
#if HAVE_SMPI
  if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
    /**
     * paje currently (May 2016) uses "Filename" and "Linenumber" as
     * reserved words. We cannot use them...
     */
    fprintf(tracing_file, "%%       Fname string\n");
    fprintf(tracing_file, "%%       Lnumber int\n");
  }
#endif
  fprintf(tracing_file, "%%EndEventDef\n");
}
Ejemplo n.º 18
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;
}
Ejemplo n.º 19
0
void new_pajeSetState (double timestamp, container_t container, type_t type, val_t value)
{
  paje_event_t event = xbt_new0(s_paje_event_t, 1);
  event->event_type = PAJE_SetState;
  event->timestamp = timestamp;
  event->print = active_writer.print_SetState;
  event->free = free_paje_event;
  event->data = xbt_new0(s_setState_t, 1);
  ((setState_t)(event->data))->type = type;
  ((setState_t)(event->data))->container = container;
  ((setState_t)(event->data))->value = value;

#if HAVE_SMPI
  if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
    smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
    ((setState_t)(event->data))->filename   = loc->filename;
    ((setState_t)(event->data))->linenumber = loc->linenumber;
  }
#endif

  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event->event_type, event->timestamp);

  insert_into_buffer (event);
}
Ejemplo n.º 20
0
static void TRACE_getopts(void)
{
  trace_enabled = xbt_cfg_get_boolean(OPT_TRACING);
  trace_platform = xbt_cfg_get_boolean(OPT_TRACING_PLATFORM);
  trace_platform_topology = xbt_cfg_get_boolean(OPT_TRACING_TOPOLOGY);
  trace_smpi_enabled = xbt_cfg_get_boolean(OPT_TRACING_SMPI);
  trace_smpi_grouped = xbt_cfg_get_boolean(OPT_TRACING_SMPI_GROUP);
  trace_smpi_computing = xbt_cfg_get_boolean(OPT_TRACING_SMPI_COMPUTING);
  trace_smpi_sleeping = xbt_cfg_get_boolean(OPT_TRACING_SMPI_SLEEPING);
  trace_view_internals = xbt_cfg_get_boolean(OPT_TRACING_SMPI_INTERNALS);
  trace_categorized = xbt_cfg_get_boolean(OPT_TRACING_CATEGORIZED);
  trace_uncategorized = xbt_cfg_get_boolean(OPT_TRACING_UNCATEGORIZED);
  trace_msg_process_enabled = xbt_cfg_get_boolean(OPT_TRACING_MSG_PROCESS);
  trace_msg_vm_enabled = xbt_cfg_get_boolean(OPT_TRACING_MSG_VM);
  trace_buffer = xbt_cfg_get_boolean(OPT_TRACING_BUFFER);
  trace_onelink_only = xbt_cfg_get_boolean(OPT_TRACING_ONELINK_ONLY);
  trace_disable_destroy = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_DESTROY);
  trace_basic = xbt_cfg_get_boolean(OPT_TRACING_BASIC);
  trace_display_sizes = xbt_cfg_get_boolean(OPT_TRACING_DISPLAY_SIZES);
  trace_disable_link = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_LINK);
  trace_disable_power = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_POWER);
  trace_precision = xbt_cfg_get_int(OPT_TRACING_PRECISION);
}
Ejemplo n.º 21
0
static void _sg_cfg_cb_verbose_exit(const char *name)
{
  _sg_do_verbose_exit = xbt_cfg_get_boolean(name);
}
Ejemplo n.º 22
0
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);
}
Ejemplo n.º 23
0
static void _sg_cfg_cb__surf_network_crosstraffic(const char *name,
                                                  int pos)
{
  sg_network_crosstraffic = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
Ejemplo n.º 24
0
static void _sg_cfg_cb_verbose_exit(const char *name, int pos)
{
  _sg_do_verbose_exit = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
Ejemplo n.º 25
0
static void _sg_cfg_cb_clean_atexit(const char *name, int pos)
{
  _sg_do_clean_atexit = xbt_cfg_get_boolean(_sg_cfg_set, name);
}
Ejemplo n.º 26
0
static void _sg_cfg_cb_msg_debug_multiple_use(const char *name)
{
  msg_global->debug_multiple_use = xbt_cfg_get_boolean(name);
}
Ejemplo n.º 27
0
int sg_cfg_get_boolean(const char* name)
{
  return xbt_cfg_get_boolean(_sg_cfg_set, name);
}
Ejemplo n.º 28
0
int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
{
  srand(SMPI_RAND_SEED);

  if (getenv("SMPI_PRETEND_CC") != NULL) {
    /* Hack to ensure that smpicc can pretend to be a simple compiler. Particularly handy to pass it to the
     * configuration tools */
    return 0;
  }
  smpi_init_logs();

  TRACE_global_init(&argc, argv);
  TRACE_add_start_function(TRACE_smpi_alloc);
  TRACE_add_end_function(TRACE_smpi_release);

  SIMIX_global_init(&argc, argv);
  MSG_init(&argc,argv);

  SMPI_switch_data_segment = smpi_switch_data_segment;

  smpi_init_options();

  // parse the platform file: get the host list
  SIMIX_create_environment(argv[1]);
  SIMIX_comm_set_copy_data_callback(&smpi_comm_copy_buffer_callback);
  SIMIX_function_register_default(realmain);
  SIMIX_launch_application(argv[2]);

  smpi_global_init();

  smpi_check_options();

  if(smpi_privatize_global_variables)
    smpi_initialize_global_memory_segments();

  /* Clean IO before the run */
  fflush(stdout);
  fflush(stderr);

  if (MC_is_active()) {
    MC_run();
  } else {
  
    SIMIX_run();

    xbt_os_walltimer_stop(global_timer);
    if (xbt_cfg_get_boolean("smpi/display-timing")){
      double global_time = xbt_os_timer_elapsed(global_timer);
      XBT_INFO("Simulated time: %g seconds. \n\n"
          "The simulation took %g seconds (after parsing and platform setup)\n"
          "%g seconds were actual computation of the application",
          SIMIX_get_clock(), global_time , smpi_total_benched_time);
          
      if (smpi_total_benched_time/global_time>=0.75)
      XBT_INFO("More than 75%% of the time was spent inside the application code.\n"
      "You may want to use sampling functions or trace replay to reduce this.");
    }
  }
  int count = smpi_process_count();
  int i, ret=0;
  for (i = 0; i < count; i++) {
    if(process_data[i]->return_value!=0){
      ret=process_data[i]->return_value;//return first non 0 value
      break;
    }
  }
  smpi_global_destroy();

  TRACE_end();

  return ret;
}
Ejemplo n.º 29
0
static void _sg_cfg_cb_model_check_record(const char *name) {
  _sg_do_model_check_record = xbt_cfg_get_boolean(name);
}
Ejemplo n.º 30
0
static void _sg_cfg_cb_clean_atexit(const char *name)
{
  _sg_do_clean_atexit = xbt_cfg_get_boolean(name);
}