/** \ingroup msg_task_usage * \brief Executes a parallel task and waits for its termination. * * \param task a #msg_task_t to execute on the location on which the process is running. * * \return #MSG_OK if the task was successfully completed, #MSG_TASK_CANCELED * or #MSG_HOST_FAILURE otherwise */ msg_error_t MSG_parallel_task_execute(msg_task_t task) { xbt_ex_t e; simdata_task_t simdata = task->simdata; msg_process_t self = SIMIX_process_self(); simdata_process_t p_simdata = SIMIX_process_self_get_data(self); e_smx_state_t comp_state; msg_error_t status = MSG_OK; #ifdef HAVE_TRACING TRACE_msg_task_execute_start(task); #endif xbt_assert((!simdata->compute) && (task->simdata->isused == 0), "This task is executed somewhere else. Go fix your code! %d", task->simdata->isused); XBT_DEBUG("Computing on %s", MSG_process_get_name(MSG_process_self())); if (simdata->computation_amount == 0 && !simdata->host_nb) { #ifdef HAVE_TRACING TRACE_msg_task_execute_end(task); #endif return MSG_OK; } TRY { simdata->isused=1; if (simdata->host_nb > 0) { simdata->compute = simcall_host_parallel_execute(task->name, simdata->host_nb, simdata->host_list, simdata->comp_amount, simdata->comm_amount, 1.0, -1.0); XBT_DEBUG("Parallel execution action created: %p", simdata->compute); } else { simdata->compute = simcall_host_execute(task->name, p_simdata->m_host, simdata->computation_amount, simdata->priority); } #ifdef HAVE_TRACING simcall_set_category(simdata->compute, task->category); #endif p_simdata->waiting_action = simdata->compute; comp_state = simcall_host_execution_wait(simdata->compute); p_simdata->waiting_action = NULL; simdata->isused=0; XBT_DEBUG("Execution task '%s' finished in state %d", task->name, (int)comp_state); } CATCH(e) { switch (e.category) { case cancel_error: status = MSG_TASK_CANCELED; break; default: RETHROW; } xbt_ex_free(e); } /* action ended, set comm and compute = NULL, the actions is already destroyed * in the main function */ simdata->computation_amount = 0.0; simdata->comm = NULL; simdata->compute = NULL; #ifdef HAVE_TRACING TRACE_msg_task_execute_end(task); #endif MSG_RETURN(status); }
/** \ingroup m_task_management * \brief Return the name of a #msg_task_t. * * This functions returns the name of a #msg_task_t as specified on creation */ const char *MSG_task_get_name(msg_task_t task) { xbt_assert(task, "Invalid parameters"); return task->name; }
/** \ingroup msg_task_usage * \brief Executes a parallel task and waits for its termination. * * \param task a #msg_task_t to execute on the location on which the process is running. * * \return #MSG_OK if the task was successfully completed, #MSG_TASK_CANCELED * or #MSG_HOST_FAILURE otherwise */ msg_error_t MSG_parallel_task_execute(msg_task_t task) { simdata_task_t simdata = task->simdata; simdata_process_t p_simdata = (simdata_process_t) SIMIX_process_self_get_data(); e_smx_state_t comp_state; msg_error_t status = MSG_OK; TRACE_msg_task_execute_start(task); xbt_assert((!simdata->compute) && !task->simdata->isused, "This task is executed somewhere else. Go fix your code!"); XBT_DEBUG("Computing on %s", MSG_process_get_name(MSG_process_self())); if (simdata->flops_amount == 0 && !simdata->host_nb) { TRACE_msg_task_execute_end(task); return MSG_OK; } try { simdata->setUsed(); if (simdata->host_nb > 0) { simdata->compute = static_cast<simgrid::simix::Exec*>( simcall_execution_parallel_start(task->name, simdata->host_nb,simdata->host_list, simdata->flops_parallel_amount, simdata->bytes_parallel_amount, 1.0, -1.0)); XBT_DEBUG("Parallel execution action created: %p", simdata->compute); } else { unsigned long affinity_mask = (unsigned long)(uintptr_t) xbt_dict_get_or_null_ext(simdata->affinity_mask_db, (char *) p_simdata->m_host, sizeof(msg_host_t)); XBT_DEBUG("execute %s@%s with affinity(0x%04lx)", MSG_task_get_name(task), MSG_host_get_name(p_simdata->m_host), affinity_mask); simdata->compute = static_cast<simgrid::simix::Exec*>( simcall_execution_start(task->name, simdata->flops_amount, simdata->priority, simdata->bound, affinity_mask)); } simcall_set_category(simdata->compute, task->category); p_simdata->waiting_action = simdata->compute; comp_state = simcall_execution_wait(simdata->compute); p_simdata->waiting_action = nullptr; simdata->setNotUsed(); XBT_DEBUG("Execution task '%s' finished in state %d", task->name, (int)comp_state); } catch (xbt_ex& e) { switch (e.category) { case cancel_error: status = MSG_TASK_CANCELED; break; case host_error: status = MSG_HOST_FAILURE; break; default: throw; } } /* action ended, set comm and compute = nullptr, the actions is already destroyed in the main function */ simdata->flops_amount = 0.0; simdata->comm = nullptr; simdata->compute = nullptr; TRACE_msg_task_execute_end(task); MSG_RETURN(status); }
/** \ingroup m_task_management * \brief Return the user data of a #msg_task_t. * * This function checks whether \a task is a valid pointer or not and return the user data associated to \a task if it is possible. */ void *MSG_task_get_data(msg_task_t task) { xbt_assert((task != NULL), "Invalid parameter"); return (task->data); }
/** \ingroup m_task_management * \brief Return the sender of a #msg_task_t. * * This functions returns the #msg_process_t which sent this task */ msg_process_t MSG_task_get_sender(msg_task_t task) { xbt_assert(task, "Invalid parameters"); return ((simdata_task_t) task->simdata)->sender; }
int smpi_coll_tuned_reduce_scatter_mpich_noncomm(void *sendbuf, void *recvbuf, int recvcounts[], MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) { int mpi_errno = MPI_SUCCESS; int comm_size = smpi_comm_size(comm) ; int rank = smpi_comm_rank(comm); int pof2; int log2_comm_size; int i, k; int recv_offset, send_offset; int block_size, total_count, size; MPI_Aint true_extent, true_lb; int buf0_was_inout; void *tmp_buf0; void *tmp_buf1; void *result_ptr; smpi_datatype_extent(datatype, &true_lb, &true_extent); pof2 = 1; log2_comm_size = 0; while (pof2 < comm_size) { pof2 <<= 1; ++log2_comm_size; } /* begin error checking */ xbt_assert(pof2 == comm_size); /* FIXME this version only works for power of 2 procs */ for (i = 0; i < (comm_size - 1); ++i) { xbt_assert(recvcounts[i] == recvcounts[i+1]); } /* end error checking */ /* size of a block (count of datatype per block, NOT bytes per block) */ block_size = recvcounts[0]; total_count = block_size * comm_size; tmp_buf0=( void *)xbt_malloc( true_extent * total_count); tmp_buf1=( void *)xbt_malloc( true_extent * total_count); /* adjust for potential negative lower bound in datatype */ tmp_buf0 = (void *)((char*)tmp_buf0 - true_lb); tmp_buf1 = (void *)((char*)tmp_buf1 - true_lb); /* Copy our send data to tmp_buf0. We do this one block at a time and permute the blocks as we go according to the mirror permutation. */ for (i = 0; i < comm_size; ++i) { mpi_errno = smpi_datatype_copy((char *)(sendbuf == MPI_IN_PLACE ? recvbuf : sendbuf) + (i * true_extent * block_size), block_size, datatype, (char *)tmp_buf0 + (MPIU_Mirror_permutation(i, log2_comm_size) * true_extent * block_size), block_size, datatype); if (mpi_errno) return(mpi_errno); } buf0_was_inout = 1; send_offset = 0; recv_offset = 0; size = total_count; for (k = 0; k < log2_comm_size; ++k) { /* use a double-buffering scheme to avoid local copies */ char *incoming_data = (buf0_was_inout ? tmp_buf1 : tmp_buf0); char *outgoing_data = (buf0_was_inout ? tmp_buf0 : tmp_buf1); int peer = rank ^ (0x1 << k); size /= 2; if (rank > peer) { /* we have the higher rank: send top half, recv bottom half */ recv_offset += size; } else { /* we have the lower rank: recv top half, send bottom half */ send_offset += size; } smpi_mpi_sendrecv(outgoing_data + send_offset*true_extent, size, datatype, peer, COLL_TAG_SCATTER, incoming_data + recv_offset*true_extent, size, datatype, peer, COLL_TAG_SCATTER, comm, MPI_STATUS_IGNORE); /* always perform the reduction at recv_offset, the data at send_offset is now our peer's responsibility */ if (rank > peer) { /* higher ranked value so need to call op(received_data, my_data) */ smpi_op_apply(op, incoming_data + recv_offset*true_extent, outgoing_data + recv_offset*true_extent, &size, &datatype ); /* buf0_was_inout = buf0_was_inout; */ } else { /* lower ranked value so need to call op(my_data, received_data) */ smpi_op_apply( op, outgoing_data + recv_offset*true_extent, incoming_data + recv_offset*true_extent, &size, &datatype); buf0_was_inout = !buf0_was_inout; } /* the next round of send/recv needs to happen within the block (of size "size") that we just received and reduced */ send_offset = recv_offset; } xbt_assert(size == recvcounts[rank]); /* copy the reduced data to the recvbuf */ result_ptr = (char *)(buf0_was_inout ? tmp_buf0 : tmp_buf1) + recv_offset * true_extent; mpi_errno = smpi_datatype_copy(result_ptr, size, datatype, recvbuf, size, datatype); if (mpi_errno) return(mpi_errno); return MPI_SUCCESS; }
int main(int argc, char **argv) { double now = -1.0; surf_init(&argc, argv); /* Initialize some common structures */ xbt_cfg_set_parse("cpu/model:Cas01"); xbt_cfg_set_parse("network/model:CM02"); xbt_assert(argc > 1, "Usage: %s platform.xml\n", argv[0]); parse_platform_file(argv[1]); XBT_DEBUG("CPU model: %p", surf_cpu_model_pm); XBT_DEBUG("Network model: %p", surf_network_model); simgrid::s4u::Host* hostA = sg_host_by_name("Cpu A"); simgrid::s4u::Host* hostB = sg_host_by_name("Cpu B"); /* Let's do something on it */ simgrid::surf::Action* actionA = hostA->pimpl_cpu->execution_start(1000.0); simgrid::surf::Action* actionB = hostB->pimpl_cpu->execution_start(1000.0); simgrid::surf::Action* actionC = hostB->pimpl_cpu->sleep(7.32); simgrid::surf::Action::State stateActionA = actionA->getState(); simgrid::surf::Action::State stateActionB = actionB->getState(); simgrid::surf::Action::State stateActionC = actionC->getState(); /* And just look at the state of these tasks */ XBT_INFO("actionA state: %s", string_action(stateActionA)); XBT_INFO("actionB state: %s", string_action(stateActionB)); XBT_INFO("actionC state: %s", string_action(stateActionC)); /* Let's do something on it */ surf_network_model->communicate(hostA, hostB, 150.0, -1.0); surf_solve(-1.0); do { simgrid::surf::ActionList *action_list = nullptr; now = surf_get_clock(); XBT_INFO("Next Event : %g", now); XBT_DEBUG("\t CPU actions"); action_list = surf_cpu_model_pm->getFailedActionSet(); for(simgrid::surf::ActionList::iterator it(action_list->begin()), itNext = it, itend(action_list->end()) ; it != itend ; it=itNext) { ++itNext; simgrid::surf::Action *action = static_cast<simgrid::surf::CpuAction*>(&*it); XBT_INFO(" CPU Failed action"); XBT_DEBUG("\t * Failed : %p", action); action->unref(); } action_list = surf_cpu_model_pm->getDoneActionSet(); for(simgrid::surf::ActionList::iterator it(action_list->begin()), itNext = it, itend(action_list->end()) ; it != itend ; it=itNext) { ++itNext; simgrid::surf::Action *action = static_cast<simgrid::surf::CpuAction*>(&*it); XBT_INFO(" CPU Done action"); XBT_DEBUG("\t * Done : %p", action); action->unref(); } action_list = surf_network_model->getFailedActionSet(); for(simgrid::surf::ActionList::iterator it(action_list->begin()), itNext = it, itend(action_list->end()) ; it != itend ; it=itNext) { ++itNext; simgrid::surf::Action *action = static_cast<simgrid::surf::NetworkAction*>(&*it); XBT_INFO(" Network Failed action"); XBT_DEBUG("\t * Failed : %p", action); action->unref(); } action_list = surf_network_model->getDoneActionSet(); for(simgrid::surf::ActionList::iterator it(action_list->begin()), itNext = it, itend(action_list->end()) ; it != itend ; it=itNext) { ++itNext; simgrid::surf::Action *action = static_cast<simgrid::surf::NetworkAction*>(&*it); XBT_INFO(" Network Done action"); XBT_DEBUG("\t * Done : %p", action); action->unref(); } } while ((surf_network_model->getRunningActionSet()->size() || surf_cpu_model_pm->getRunningActionSet()->size()) && surf_solve(-1.0) >= 0.0); XBT_DEBUG("Simulation Terminated"); return 0; }
msg_error_t MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, msg_task_t task, double timeout) { msg_error_t ret = MSG_OK; simdata_task_t t_simdata = NULL; msg_process_t process = MSG_process_self(); simdata_process_t p_simdata = SIMIX_process_self_get_data(process); int call_end = TRACE_msg_task_put_start(task); //must be after CHECK_HOST() /* Prepare the task to send */ t_simdata = task->simdata; t_simdata->sender = process; t_simdata->source = ((simdata_process_t) SIMIX_process_self_get_data(process))->m_host; if (t_simdata->isused != 0) { if (msg_global->debug_multiple_use){ XBT_ERROR("This task is already used in there:"); xbt_backtrace_display(t_simdata->isused); XBT_ERROR("And you try to reuse it from here:"); xbt_backtrace_display_current(); } else { xbt_assert(t_simdata->isused == 0, "This task is still being used somewhere else. You cannot send it now. Go fix your code! (use --cfg=msg/debug_multiple_use:on to get the backtrace of the other process)"); } } if (msg_global->debug_multiple_use) MSG_BT(t_simdata->isused, "Using Backtrace"); else t_simdata->isused = (void*)1; t_simdata->comm = NULL; msg_global->sent_msg++; p_simdata->waiting_task = task; xbt_ex_t e; /* Try to send it by calling SIMIX network layer */ TRY { smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simix call */ comm = simcall_comm_isend(SIMIX_process_self(), mailbox,t_simdata->bytes_amount, t_simdata->rate, task, sizeof(void *), NULL, NULL, NULL, task, 0); if (TRACE_is_enabled()) simcall_set_category(comm, task->category); t_simdata->comm = comm; simcall_comm_wait(comm, timeout); } CATCH(e) { switch (e.category) { case cancel_error: ret = MSG_HOST_FAILURE; break; case network_error: ret = MSG_TRANSFER_FAILURE; break; case timeout_error: ret = MSG_TIMEOUT; break; default: RETHROW; } xbt_ex_free(e); /* If the send failed, it is not used anymore */ if (msg_global->debug_multiple_use && t_simdata->isused!=0) xbt_ex_free(*(xbt_ex_t*)t_simdata->isused); t_simdata->isused = 0; } p_simdata->waiting_task = NULL; if (call_end) TRACE_msg_task_put_end(); MSG_RETURN(ret); }
void intrusive_ptr_add_ref(s_smx_cond_t *cond) { auto previous = (cond->refcount_)++; xbt_assert(previous != 0); (void) previous; }
/** \ingroup m_process_management * \brief Return the name of an agent. * * This function checks whether \a process is a valid pointer or not and return its name. */ const char *MSG_process_get_name(m_process_t process) { xbt_assert(process, "Invalid parameter"); return SIMIX_req_process_get_name(process); }
/** \ingroup m_process_management * \brief Returns true if the process is suspended . * * This checks whether a process is suspended or not by inspecting the * task on which it was waiting for the completion. */ int MSG_process_is_suspended(m_process_t process) { xbt_assert(process != NULL, "Invalid parameter"); return SIMIX_req_process_is_suspended(process); }
/* create the config set, register what should be and parse the command line*/ void surf_config_init(int *argc, char **argv) { char *description = xbt_malloc(1024), *p = description; char *default_value; double double_default_value; int default_value_int; int i; /* Create the configuration support */ if (_surf_init_status == 0) { /* Only create stuff if not already inited */ _surf_init_status = 1; sprintf(description, "The model to use for the CPU. Possible values: "); p = description; while (*(++p) != '\0'); for (i = 0; surf_cpu_model_description[i].name; i++) p += sprintf(p, "%s%s", (i == 0 ? "" : ", "), surf_cpu_model_description[i].name); sprintf(p, ".\n (use 'help' as a value to see the long description of each model)"); default_value = xbt_strdup("Cas01"); xbt_cfg_register(&_surf_cfg_set, "cpu/model", description, xbt_cfgelm_string, &default_value, 1, 1, &_surf_cfg_cb__cpu_model, NULL); sprintf(description, "The model to use for the network. Possible values: "); p = description; while (*(++p) != '\0'); for (i = 0; surf_network_model_description[i].name; i++) p += sprintf(p, "%s%s", (i == 0 ? "" : ", "), surf_network_model_description[i].name); sprintf(p, ".\n (use 'help' as a value to see the long description of each model)"); default_value = xbt_strdup("LV08"); xbt_cfg_register(&_surf_cfg_set, "network/model", description, xbt_cfgelm_string, &default_value, 1, 1, &_surf_cfg_cb__network_model, NULL); sprintf(description, "The model to use for the workstation. Possible values: "); p = description; while (*(++p) != '\0'); for (i = 0; surf_workstation_model_description[i].name; i++) p += sprintf(p, "%s%s", (i == 0 ? "" : ", "), surf_workstation_model_description[i].name); sprintf(p, ".\n (use 'help' as a value to see the long description of each model)"); default_value = xbt_strdup("CLM03"); xbt_cfg_register(&_surf_cfg_set, "workstation/model", description, xbt_cfgelm_string, &default_value, 1, 1, &_surf_cfg_cb__workstation_model, NULL); xbt_free(description); default_value = xbt_strdup("Full"); xbt_cfg_register(&_surf_cfg_set, "routing", "Model to use to store the routing information", xbt_cfgelm_string, &default_value, 1, 1, NULL, NULL); xbt_cfg_register(&_surf_cfg_set, "TCP_gamma", "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; Use the last given value, which is the max window size)", xbt_cfgelm_double, NULL, 1, 1, _surf_cfg_cb__tcp_gamma, NULL); xbt_cfg_setdefault_double(_surf_cfg_set, "TCP_gamma", 20000.0); xbt_cfg_register(&_surf_cfg_set, "maxmin/precision", "Minimum retained action value when updating simulation", xbt_cfgelm_double, NULL, 1, 1, _surf_cfg_cb__maxmin_precision, NULL); xbt_cfg_setdefault_double(_surf_cfg_set, "maxmin/precision", 0.00001); // FIXME use setdefault everywhere here! /* The parameters of network models */ double_default_value = 0.0; xbt_cfg_register(&_surf_cfg_set, "network/sender_gap", "Minimum gap between two overlapping sends", xbt_cfgelm_double, &double_default_value, 1, 1, _surf_cfg_cb__sender_gap, NULL); double_default_value = 1.0; xbt_cfg_register(&_surf_cfg_set, "network/latency_factor", "Correction factor to apply to the provided latency (default value set by network model)", xbt_cfgelm_double, &double_default_value, 1, 1, _surf_cfg_cb__latency_factor, NULL); double_default_value = 1.0; xbt_cfg_register(&_surf_cfg_set, "network/bandwidth_factor", "Correction factor to apply to the provided bandwidth (default value set by network model)", xbt_cfgelm_double, &double_default_value, 1, 1, _surf_cfg_cb__bandwidth_factor, NULL); double_default_value = 0.0; xbt_cfg_register(&_surf_cfg_set, "network/weight_S", "Correction factor to apply to the weight of competing streams(default value set by network model)", xbt_cfgelm_double, &double_default_value, 1, 1, _surf_cfg_cb__weight_S, NULL); /* Inclusion path */ xbt_cfg_register(&_surf_cfg_set, "path", "Lookup path for inclusions in platform and deployment XML files", xbt_cfgelm_string, NULL, 0, 0, _surf_cfg_cb__surf_path, NULL); default_value_int = 0; xbt_cfg_register(&_surf_cfg_set, "maxmin_selective_update", "Update the constraint set propagating recursively to others constraints", xbt_cfgelm_int, &default_value_int, 0, 1, _surf_cfg_cb__surf_maxmin_selective_update, NULL); /* do model-check */ default_value_int = 0; xbt_cfg_register(&_surf_cfg_set, "model-check", "Activate the model-checking of the \"simulated\" system (EXPERIMENTAL -- msg only for now)", xbt_cfgelm_int, &default_value_int, 0, 1, _surf_cfg_cb_model_check, NULL); /* FIXME: this function is not setting model-check to it's default value because internally it calls to variable->cb_set that in this case is the function _surf_cfg_cb_model_check which sets it's value to 1 (instead of the defalut value 0) xbt_cfg_set_int(_surf_cfg_set, "model-check", default_value_int); */ /* context factory */ default_value = xbt_strdup("ucontext"); xbt_cfg_register(&_surf_cfg_set, "contexts/factory", "Context factory to use in SIMIX (ucontext, thread or raw)", xbt_cfgelm_string, &default_value, 1, 1, _surf_cfg_cb_context_factory, NULL); /* stack size of contexts in Ko */ default_value_int = 128; xbt_cfg_register(&_surf_cfg_set, "contexts/stack_size", "Stack size of contexts in Ko (ucontext or raw only)", xbt_cfgelm_int, &default_value_int, 1, 1, _surf_cfg_cb_context_stack_size, NULL); /* number of parallel threads for user processes */ default_value_int = 1; xbt_cfg_register(&_surf_cfg_set, "contexts/nthreads", "Number of parallel threads for user contexts (EXPERIMENTAL)", xbt_cfgelm_int, &default_value_int, 1, 1, _surf_cfg_cb_contexts_nthreads, NULL); /* minimal number of user contexts to be run in parallel */ default_value_int = 1; xbt_cfg_register(&_surf_cfg_set, "contexts/parallel_threshold", "Minimal number of user contexts to be run in parallel", xbt_cfgelm_int, &default_value_int, 1, 1, _surf_cfg_cb_contexts_parallel_threshold, NULL); default_value_int = 0; xbt_cfg_register(&_surf_cfg_set, "fullduplex", "Activate the interferences between uploads and downloads for fluid max-min models (LV08, CM03)", xbt_cfgelm_int, &default_value_int, 0, 1, _surf_cfg_cb__surf_network_fullduplex, NULL); xbt_cfg_setdefault_int(_surf_cfg_set, "fullduplex", default_value_int); #ifdef HAVE_GTNETS xbt_cfg_register(&_surf_cfg_set, "gtnets_jitter", "Double value to oscillate the link latency, uniformly in random interval [-latency*gtnets_jitter,latency*gtnets_jitter)", xbt_cfgelm_double, NULL, 1, 1, _surf_cfg_cb__gtnets_jitter, NULL); xbt_cfg_setdefault_double(_surf_cfg_set, "gtnets_jitter", 0.0); default_value_int = 10; xbt_cfg_register(&_surf_cfg_set, "gtnets_jitter_seed", "Use a positive seed to reproduce jitted results, value must be in [1,1e8], default is 10", xbt_cfgelm_int, &default_value_int, 0, 1, _surf_cfg_cb__gtnets_jitter_seed, NULL); #endif if (!surf_path) { /* retrieves the current directory of the current process */ const char *initial_path = __surf_get_initial_path(); xbt_assert((initial_path), "__surf_get_initial_path() failed! Can't resolves current Windows directory"); surf_path = xbt_dynar_new(sizeof(char *), NULL); xbt_cfg_setdefault_string(_surf_cfg_set, "path", initial_path); } surf_config_cmd_line(argc, argv); } else { XBT_WARN("Call to surf_config_init() after initialization ignored"); } }
memory_map_t get_memory_map(void) { FILE *fp; /* File pointer to process's proc maps file */ char *line = NULL; /* Temporal storage for each line that is readed */ ssize_t read; /* Number of bytes readed */ size_t n = 0; /* Amount of bytes to read by getline */ memory_map_t ret = NULL; /* The memory map to return */ /* The following variables are used during the parsing of the file "maps" */ s_map_region memreg; /* temporal map region used for creating the map */ char *lfields[6], *tok, *endptr; int i; /* Open the actual process's proc maps file and create the memory_map_t */ /* to be returned. */ fp = fopen("/proc/self/maps", "r"); xbt_assert(fp, "Cannot open /proc/self/maps to investigate the memory map of the process. Please report this bug."); ret = xbt_new0(s_memory_map_t, 1); /* Read one line at the time, parse it and add it to the memory map to be returned */ while ((read = getline(&line, &n, fp)) != -1) { /* Wipeout the new line character */ line[read - 1] = '\0'; /* Tokenize the line using spaces as delimiters and store each token */ /* in lfields array. We expect 5 tokens/fields */ lfields[0] = strtok(line, " "); for (i = 1; i < 6 && lfields[i - 1] != NULL; i++) { lfields[i] = strtok(NULL, " "); } /* Check to see if we got the expected amount of columns */ if (i < 6) xbt_abort(); /* Ok we are good enough to try to get the info we need */ /* First get the start and the end address of the map */ tok = strtok(lfields[0], "-"); if (tok == NULL) xbt_abort(); memreg.start_addr = (void *) strtoul(tok, &endptr, 16); /* Make sure that the entire string was an hex number */ if (*endptr != '\0') xbt_abort(); tok = strtok(NULL, "-"); if (tok == NULL) xbt_abort(); memreg.end_addr = (void *) strtoul(tok, &endptr, 16); /* Make sure that the entire string was an hex number */ if (*endptr != '\0') xbt_abort(); /* Get the permissions flags */ if (strlen(lfields[1]) < 4) xbt_abort(); memreg.prot = 0; for (i = 0; i < 3; i++){ switch(lfields[1][i]){ case 'r': memreg.prot |= PROT_READ; break; case 'w': memreg.prot |= PROT_WRITE; break; case 'x': memreg.prot |= PROT_EXEC; break; default: break; } } if (memreg.prot == 0) memreg.prot |= PROT_NONE; if (lfields[1][4] == 'p') memreg.flags |= MAP_PRIVATE; else if (lfields[1][4] == 's') memreg.flags |= MAP_SHARED; /* Get the offset value */ memreg.offset = (void *) strtoul(lfields[2], &endptr, 16); /* Make sure that the entire string was an hex number */ if (*endptr != '\0') xbt_abort(); /* Get the device major:minor bytes */ tok = strtok(lfields[3], ":"); if (tok == NULL) xbt_abort(); memreg.dev_major = (char) strtoul(tok, &endptr, 16); /* Make sure that the entire string was an hex number */ if (*endptr != '\0') xbt_abort(); tok = strtok(NULL, ":"); if (tok == NULL) xbt_abort(); memreg.dev_minor = (char) strtoul(tok, &endptr, 16); /* Make sure that the entire string was an hex number */ if (*endptr != '\0') xbt_abort(); /* Get the inode number and make sure that the entire string was a long int */ memreg.inode = strtoul(lfields[4], &endptr, 10); if (*endptr != '\0') xbt_abort(); /* And finally get the pathname */ memreg.pathname = xbt_strdup(lfields[5]); /* Create space for a new map region in the region's array and copy the */ /* parsed stuff from the temporal memreg variable */ ret->regions = xbt_realloc(ret->regions, sizeof(memreg) * (ret->mapsize + 1)); memcpy(ret->regions + ret->mapsize, &memreg, sizeof(memreg)); ret->mapsize++; } if (line) free(line); return ret; }
void STag_surfxml_host(void){ AS_TAG = 0; xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)"); }
/** Emitter function */ int master(int argc, char *argv[]) { int workers_count = 0; msg_host_t *workers = NULL; msg_task_t *todo = NULL; msg_host_t host_self = MSG_host_self(); char *master_name = (char *) MSG_host_get_name(host_self); double task_comp_size = 0; double task_comm_size = 0; char channel[1024]; double timeout = -1; int i; TRACE_category(master_name); _XBT_GNUC_UNUSED int res = sscanf(argv[1], "%lg", &timeout); xbt_assert(res,"Invalid argument %s\n", argv[1]); res = sscanf(argv[2], "%lg", &task_comp_size); xbt_assert(res, "Invalid argument %s\n", argv[2]); res = sscanf(argv[3], "%lg", &task_comm_size); xbt_assert(res, "Invalid argument %s\n", argv[3]); { /* Process organisation */ workers_count = MSG_get_host_number(); workers = xbt_dynar_to_array(MSG_hosts_as_dynar()); for (i = 0; i < workers_count; i++) if(host_self == workers[i]) { workers[i] = workers[workers_count-1]; workers_count--; break; } for (i = 0; i < workers_count; i++) MSG_process_create("worker", worker, master_name, workers[i]); } XBT_INFO("Got %d workers and will send tasks for %g seconds!", workers_count, timeout); xbt_dynar_t idle_hosts = xbt_dynar_new(sizeof(msg_host_t), NULL); msg_host_t request_host = NULL; for (i = 0; 1;) { char sprintf_buffer[64]; msg_task_t task = NULL; msg_task_t request = NULL; while(MSG_task_listen(master_name)) { res = MSG_task_receive(&(request),master_name); xbt_assert(res == MSG_OK, "MSG_task_receive failed"); request_host = MSG_task_get_data(request); xbt_dynar_push(idle_hosts, &request_host); MSG_task_destroy(request); request = NULL; } if(MSG_get_clock()>timeout) { if(xbt_dynar_length(idle_hosts) == workers_count) break; else { MSG_process_sleep(.1); continue; } } if(xbt_dynar_length(idle_hosts)<=0) { /* No request. Let's wait... */ MSG_process_sleep(.1); continue; } sprintf(sprintf_buffer, "Task_%d", i); task = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL); MSG_task_set_category(task, master_name); xbt_dynar_shift(idle_hosts, &request_host); build_channel_name(channel,master_name, MSG_host_get_name(request_host)); XBT_DEBUG("Sending \"%s\" to channel \"%s\"", task->name, channel); MSG_task_send(task, channel); XBT_DEBUG("Sent"); i++; } int task_num = i; XBT_DEBUG ("All tasks have been dispatched. Let's tell everybody the computation is over."); for (i = 0; i < workers_count; i++) { msg_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE); MSG_task_send(finalize, build_channel_name(channel,master_name, MSG_host_get_name(workers[i % workers_count]))); } XBT_INFO("Sent %d tasks in total!", task_num); free(workers); free(todo); return 0; } /* end_of_master */
/** \ingroup m_host_management * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine. */ double MSG_get_host_speed(m_host_t h) { xbt_assert((h != NULL), "Invalid parameters"); return (SIMIX_req_host_get_speed(h->simdata->smx_host)); }
void xbt_ex_setup_backtrace(xbt_ex_t * e) //FIXME: This code could be greatly improved/simplifyied with http://cairo.sourcearchive.com/documentation/1.9.4/backtrace-symbols_8c-source.html { int i; /* to get the backtrace from the libc */ char **backtrace_syms; /* To build the commandline of addr2line */ char *cmd, *curr; /* to extract the addresses from the backtrace */ char **addrs; char buff[256]; /* To read the output of addr2line */ FILE *pipe; char line_func[1024], line_pos[1024]; /* size (in char) of pointers on this arch */ int addr_len = 0; /* To search for the right executable path when not trivial */ struct stat stat_buf; char *binary_name = NULL; xbt_assert(e, "Backtrace not setup yet, cannot set it up for display"); e->bt_strings = NULL; if (xbt_binary_name == NULL) /* no binary name, nothing to do */ return; if (e->used <= 1) return; /* ignore first one, which is xbt_backtrace_current() */ e->used--; memmove(e->bt, e->bt + 1, (sizeof *e->bt) * e->used); backtrace_syms = backtrace_symbols(e->bt, e->used); /* build the commandline */ if (stat(xbt_binary_name, &stat_buf)) { /* Damn. binary not in current dir. We'll have to dig the PATH to find it */ for (i = 0; environ[i]; i++) { if (!strncmp("PATH=", environ[i], 5)) { xbt_dynar_t path = xbt_str_split(environ[i] + 5, ":"); unsigned int cpt; char *data; xbt_dynar_foreach(path, cpt, data) { free(binary_name); binary_name = bprintf("%s/%s", data, xbt_binary_name); if (!stat(binary_name, &stat_buf)) { /* Found. */ XBT_DEBUG("Looked in the PATH for the binary. Found %s", binary_name); break; } } xbt_dynar_free(&path); if (stat(binary_name, &stat_buf)) { /* not found */ e->used = 1; e->bt_strings = xbt_new(char *, 1); e->bt_strings[0] = bprintf("(binary '%s' not found in the PATH)", xbt_binary_name); free(backtrace_syms); return; } break; }
/** \ingroup m_host_management * \brief Returns a xbt_dynar_t consisting of the list of properties assigned to this host * * \param host a host * \return a dict containing the properties */ xbt_dict_t MSG_host_get_properties(m_host_t host) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return (SIMIX_req_host_get_properties(host->simdata->smx_host)); }
JNIEXPORT void JNICALL Java_org_simgrid_msg_File_nativeInit(JNIEnv *env, jclass cls) { jclass class_File = env->FindClass("org/simgrid/msg/File"); jfile_field_bind = jxbt_get_jfield(env , class_File, "bind", "J"); xbt_assert((jfile_field_bind != nullptr), "Can't find 'bind' field in File class."); }
/** \ingroup msg_gos_functions * \brief Determine if a host is available. * * \param h host to test */ int MSG_host_is_avail(m_host_t h) { xbt_assert((h != NULL), "Invalid parameters (host is NULL)"); return (SIMIX_req_host_get_state(h->simdata->smx_host)); }
/** Emitter function */ int master(int argc, char *argv[]) { int slaves_count = 0; m_host_t *slaves = NULL; m_task_t *todo = NULL; int number_of_tasks = 0; double task_comp_size = 0; double task_comm_size = 0; int i; int read; read = sscanf(argv[1], "%d", &number_of_tasks); xbt_assert(read, "Invalid argument %s\n", argv[1]); read = sscanf(argv[2], "%lg", &task_comp_size); xbt_assert(read, "Invalid argument %s\n", argv[2]); read = sscanf(argv[3], "%lg", &task_comm_size); xbt_assert(read, "Invalid argument %s\n", argv[3]); { /* Task creation */ char sprintf_buffer[64]; todo = xbt_new0(m_task_t, number_of_tasks); for (i = 0; i < number_of_tasks; i++) { sprintf(sprintf_buffer, "Task_%d", i); todo[i] = MSG_task_create(sprintf_buffer, task_comp_size, task_comm_size, NULL); } } { /* Process organisation */ slaves_count = argc - 4; slaves = xbt_new0(m_host_t, slaves_count); for (i = 4; i < argc; i++) { slaves[i - 4] = MSG_get_host_by_name(argv[i]); if (slaves[i - 4] == NULL) { XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]); abort(); } } } XBT_INFO("Got %d slave(s) :", slaves_count); for (i = 0; i < slaves_count; i++) XBT_INFO("\t %s", slaves[i]->name); XBT_INFO("Got %d task to process :", number_of_tasks); for (i = 0; i < number_of_tasks; i++) XBT_INFO("\t\"%s\"", todo[i]->name); for (i = 0; i < number_of_tasks; i++) { XBT_INFO("Sending \"%s\" to \"%s\"", todo[i]->name, slaves[i % slaves_count]->name); if (MSG_host_self() == slaves[i % slaves_count]) { XBT_INFO("Hey ! It's me ! :)"); } MSG_task_put(todo[i], slaves[i % slaves_count], PORT_22); XBT_INFO("Send completed"); } XBT_INFO ("All tasks have been dispatched. Let's tell everybody the computation is over."); for (i = 0; i < slaves_count; i++) MSG_task_put(MSG_task_create("finalize", 0, 0, FINALIZE), slaves[i], PORT_22); XBT_INFO("Goodbye now!"); free(slaves); free(todo); return 0; } /* end_of_master */
static void action_allReduce(const char *const *action) { int i; char *allreduce_identifier; char mailbox[80]; double comm_size = parse_double(action[2]); double comp_size = parse_double(action[3]); msg_task_t task = NULL, comp_task = NULL; const char *process_name; double clock = MSG_get_clock(); process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self()); xbt_assert(communicator_size, "Size of Communicator is not defined, " "can't use collective operations"); process_name = MSG_process_get_name(MSG_process_self()); allreduce_identifier = bprintf("allReduce_%d", counters->allReduce_counter++); if (!strcmp(process_name, "p0")) { XBT_DEBUG("%s: %s is the Root", allreduce_identifier, process_name); msg_comm_t *comms = xbt_new0(msg_comm_t, communicator_size - 1); msg_task_t *tasks = xbt_new0(msg_task_t, communicator_size - 1); for (i = 1; i < communicator_size; i++) { sprintf(mailbox, "%s_p%d_p0", allreduce_identifier, i); comms[i - 1] = MSG_task_irecv(&(tasks[i - 1]), mailbox); } MSG_comm_waitall(comms, communicator_size - 1, -1); for (i = 1; i < communicator_size; i++) { MSG_comm_destroy(comms[i - 1]); MSG_task_destroy(tasks[i - 1]); } xbt_free(tasks); comp_task = MSG_task_create("allReduce_comp", comp_size, 0, NULL); XBT_DEBUG("%s: computing 'reduce_comp'", allreduce_identifier); MSG_task_execute(comp_task); MSG_task_destroy(comp_task); XBT_DEBUG("%s: computed", allreduce_identifier); for (i = 1; i < communicator_size; i++) { sprintf(mailbox, "%s_p0_p%d", allreduce_identifier, i); comms[i - 1] = MSG_task_isend(MSG_task_create(mailbox, 0, comm_size, NULL), mailbox); } MSG_comm_waitall(comms, communicator_size - 1, -1); for (i = 1; i < communicator_size; i++) MSG_comm_destroy(comms[i - 1]); xbt_free(comms); XBT_DEBUG("%s: all messages sent by %s have been received", allreduce_identifier, process_name); } else { XBT_DEBUG("%s: %s sends", allreduce_identifier, process_name); sprintf(mailbox, "%s_%s_p0", allreduce_identifier, process_name); XBT_DEBUG("put on %s", mailbox); MSG_task_send(MSG_task_create(allreduce_identifier, 0, comm_size, NULL), mailbox); sprintf(mailbox, "%s_p0_%s", allreduce_identifier, process_name); MSG_task_receive(&task, mailbox); MSG_task_destroy(task); XBT_DEBUG("%s: %s has received", allreduce_identifier, process_name); } log_action(action, MSG_get_clock() - clock); xbt_free(allreduce_identifier); }
/** \ingroup m_task_management * \brief Sets the user data of a #msg_task_t. * * This function allows to associate a new pointer to the user data associated of \a task. */ void MSG_task_set_data(msg_task_t task, void *data) { xbt_assert((task != NULL), "Invalid parameter"); task->data = data; }
/* Pick the right models for CPU, net and workstation, and call their model_init_preparse */ void surf_config_models_setup() { const char *workstation_model_name; const char *vm_workstation_model_name; int workstation_id = -1; int vm_workstation_id = -1; char *network_model_name = NULL; char *cpu_model_name = NULL; int storage_id = -1; char *storage_model_name = NULL; workstation_model_name = xbt_cfg_get_string(_sg_cfg_set, "workstation/model"); vm_workstation_model_name = xbt_cfg_get_string(_sg_cfg_set, "vm_workstation/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" workstation 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, "workstation/model")) { XBT_INFO("Switching workstation model to compound since you changed the network and/or cpu model(s)"); workstation_model_name = "compound"; xbt_cfg_set_string(_sg_cfg_set, "workstation/model", workstation_model_name); } 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"); 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 workstation_model_init"); surf_workstation_model_description[workstation_id].model_init_preparse(); XBT_DEBUG("Call vm_workstation_model_init"); vm_workstation_id = find_model_description(surf_vm_workstation_model_description, vm_workstation_model_name); surf_vm_workstation_model_description[vm_workstation_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(); }
/** \ingroup m_task_management * \brief Return the source of a #msg_task_t. * * This functions returns the #msg_host_t from which this task was sent */ msg_host_t MSG_task_get_source(msg_task_t task) { xbt_assert(task, "Invalid parameters"); return ((simdata_task_t) task->simdata)->source; }
int main(int argc, char **argv) { sg_host_t host_list[2]; double computation_amount[2]; double communication_amount[4] = { 0 }; /* initialization of SD */ SD_init(&argc, argv); xbt_assert(argc > 1, "Usage: %s platform_file\n\nExample: %s two_clusters.xml", argv[0], argv[0]); SD_create_environment(argv[1]); /* test the estimation functions */ const sg_host_t* hosts = sg_host_list(); simgrid::s4u::Host* h1 = hosts[4]; simgrid::s4u::Host* h2 = hosts[2]; double comp_amount1 = 2000000; double comp_amount2 = 1000000; double comm_amount12 = 2000000; double comm_amount21 = 3000000; XBT_INFO("Computation time for %f flops on %s: %f", comp_amount1, h1->get_cname(), comp_amount1 / h1->get_speed()); XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, h2->get_cname(), comp_amount2 / h2->get_speed()); XBT_INFO("Route between %s and %s:", h1->get_cname(), h2->get_cname()); std::vector<sg_link_t> route; double latency = 0; h1->route_to(h2, route, &latency); for (auto const& link : route) XBT_INFO(" Link %s: latency = %f, bandwidth = %f", sg_link_name(link), sg_link_latency(link), sg_link_bandwidth(link)); XBT_INFO("Route latency = %f, route bandwidth = %f", latency, sg_host_route_bandwidth(h1, h2)); XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount12, h1->get_cname(), h2->get_cname(), sg_host_route_latency(h1, h2) + comm_amount12 / sg_host_route_bandwidth(h1, h2)); XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount21, h2->get_cname(), h1->get_cname(), sg_host_route_latency(h2, h1) + comm_amount21 / sg_host_route_bandwidth(h2, h1)); /* creation of the tasks and their dependencies */ SD_task_t taskA = SD_task_create("Task A", NULL, 10.0); SD_task_t taskB = SD_task_create("Task B", NULL, 40.0); SD_task_t taskC = SD_task_create("Task C", NULL, 30.0); SD_task_t taskD = SD_task_create("Task D", NULL, 60.0); /* try to attach and retrieve user data to a task */ SD_task_set_data(taskA, static_cast<void*>(&comp_amount1)); if (fabs(comp_amount1 - (*(static_cast<double*>(SD_task_get_data(taskA))))) > 1e-12) XBT_ERROR("User data was corrupted by a simple set/get"); SD_task_dependency_add(taskB, taskA); SD_task_dependency_add(taskC, taskA); SD_task_dependency_add(taskD, taskB); SD_task_dependency_add(taskD, taskC); SD_task_dependency_add(taskB, taskC); try { SD_task_dependency_add(taskA, taskA); /* shouldn't work and must raise an exception */ xbt_die("Hey, I can add a dependency between Task A and Task A!"); } catch (xbt_ex& ex) { if (ex.category != arg_error) throw; /* this is a serious error */ } try { SD_task_dependency_add(taskB, taskA); /* shouldn't work and must raise an exception */ xbt_die("Oh oh, I can add an already existing dependency!"); } catch (xbt_ex& ex) { if (ex.category != arg_error) throw; } try { SD_task_dependency_remove(taskA, taskC); /* shouldn't work and must raise an exception */ xbt_die("Dude, I can remove an unknown dependency!"); } catch (xbt_ex& ex) { if (ex.category != arg_error) throw; } try { SD_task_dependency_remove(taskC, taskC); /* shouldn't work and must raise an exception */ xbt_die("Wow, I can remove a dependency between Task C and itself!"); } catch (xbt_ex& ex) { if (ex.category != arg_error) throw; } /* if everything is ok, no exception is forwarded or rethrown by main() */ /* watch points */ SD_task_watch(taskD, SD_DONE); SD_task_watch(taskB, SD_DONE); SD_task_unwatch(taskD, SD_DONE); /* scheduling parameters */ host_list[0] = h1; host_list[1] = h2; computation_amount[0] = comp_amount1; computation_amount[1] = comp_amount2; communication_amount[1] = comm_amount12; communication_amount[2] = comm_amount21; /* estimated time */ XBT_INFO("Estimated time for '%s': %f", SD_task_get_name(taskD), SD_task_get_execution_time(taskD, 2, host_list, computation_amount, communication_amount)); SD_task_schedule(taskA, 2, host_list, computation_amount, communication_amount, -1); SD_task_schedule(taskB, 2, host_list, computation_amount, communication_amount, -1); SD_task_schedule(taskC, 2, host_list, computation_amount, communication_amount, -1); SD_task_schedule(taskD, 2, host_list, computation_amount, communication_amount, -1); std::set<SD_task_t> *changed_tasks = simgrid::sd::simulate(-1.0); for (auto const& task : *changed_tasks) { XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task), SD_task_get_start_time(task), SD_task_get_finish_time(task)); } XBT_DEBUG("Destroying tasks..."); SD_task_destroy(taskA); SD_task_destroy(taskB); SD_task_destroy(taskC); SD_task_destroy(taskD); XBT_DEBUG("Tasks destroyed. Exiting SimDag..."); xbt_free((sg_host_t*)hosts); return 0; }
/** \ingroup m_task_management * \brief Sets the name of a #msg_task_t. * * This functions allows to associate a name to a task */ void MSG_task_set_name(msg_task_t task, const char *name) { xbt_assert(task, "Invalid parameters"); task->name = xbt_strdup(name); }
/** * \brief Return the number of elements in the dict. * \param dict a dictionary */ XBT_INLINE int xbt_dict_length(xbt_dict_t dict) { xbt_assert(dict); return dict->count; }
/* create the config set, register what should be and parse the command line*/ void sg_config_init(int *argc, char **argv) { char description[1024]; /* Create the configuration support */ if (_sg_cfg_init_status == 0) { /* Only create stuff if not already inited */ /* Plugins configuration */ describe_model(description, surf_plugin_description, "plugin", "The plugins"); xbt_cfg_register(&_sg_cfg_set, "plugin", description, xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__plugin, NULL); describe_model(description, surf_cpu_model_description, "model", "The model to use for the CPU"); xbt_cfg_register(&_sg_cfg_set, "cpu/model", description, xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__cpu_model, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "cpu/model", "Cas01"); describe_model(description, surf_optimization_mode_description, "optimization mode", "The optimization modes to use for the CPU"); xbt_cfg_register(&_sg_cfg_set, "cpu/optim", description, xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__optimization_mode, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "cpu/optim", "Lazy"); describe_model(description, surf_storage_model_description, "model", "The model to use for the storage"); xbt_cfg_register(&_sg_cfg_set, "storage/model", description, xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__storage_mode, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "storage/model", "default"); describe_model(description, surf_network_model_description, "model", "The model to use for the network"); xbt_cfg_register(&_sg_cfg_set, "network/model", description, xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__network_model, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "network/model", "LV08"); describe_model(description, surf_optimization_mode_description, "optimization mode", "The optimization modes to use for the network"); xbt_cfg_register(&_sg_cfg_set, "network/optim", description, xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__optimization_mode, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "network/optim", "Lazy"); describe_model(description, surf_host_model_description, "model", "The model to use for the host"); xbt_cfg_register(&_sg_cfg_set, "host/model", description, xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__host_model, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "host/model", "default"); describe_model(description, surf_vm_model_description, "model", "The model to use for the vm"); xbt_cfg_register(&_sg_cfg_set, "vm/model", description, xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__vm_model, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "vm/model", "default"); xbt_cfg_register(&_sg_cfg_set, "network/TCP_gamma", "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; Use the last given value, which is the max window size)", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__tcp_gamma, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "network/TCP_gamma", 4194304.0); xbt_cfg_register(&_sg_cfg_set, "surf/precision", "Numerical precision used when updating simulation times (hence this value is expressed in seconds)", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__surf_precision, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "surf/precision", 0.00001); xbt_cfg_register(&_sg_cfg_set, "maxmin/precision", "Numerical precision used when computing resource sharing (hence this value is expressed in ops/sec or bytes/sec)", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__maxmin_precision, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "maxmin/precision", 0.00001); /* The parameters of network models */ xbt_cfg_register(&_sg_cfg_set, "network/sender_gap", "Minimum gap between two overlapping sends", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__sender_gap, NULL); /* real default for "network/sender_gap" is set in network_smpi.cpp */ xbt_cfg_setdefault_double(_sg_cfg_set, "network/sender_gap", NAN); xbt_cfg_register(&_sg_cfg_set, "network/latency_factor", "Correction factor to apply to the provided latency (default value set by network model)", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__latency_factor, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0); xbt_cfg_register(&_sg_cfg_set, "network/bandwidth_factor", "Correction factor to apply to the provided bandwidth (default value set by network model)", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__bandwidth_factor, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 1.0); xbt_cfg_register(&_sg_cfg_set, "network/weight_S", "Correction factor to apply to the weight of competing streams (default value set by network model)", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__weight_S, NULL); /* real default for "network/weight_S" is set in network_*.cpp */ xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", NAN); /* Inclusion path */ xbt_cfg_register(&_sg_cfg_set, "path", "Lookup path for inclusions in platform and deployment XML files", xbt_cfgelm_string, 1, 0, _sg_cfg_cb__surf_path, NULL); xbt_cfg_register(&_sg_cfg_set, "cpu/maxmin_selective_update", "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)", xbt_cfgelm_boolean, 1, 1, NULL, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "cpu/maxmin_selective_update", "no"); xbt_cfg_register(&_sg_cfg_set, "network/maxmin_selective_update", "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)", xbt_cfgelm_boolean, 1, 1, NULL, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/maxmin_selective_update", "no"); /* Replay (this part is enabled event if MC it disabled) */ xbt_cfg_register(&_sg_cfg_set, "model-check/replay", "Uenable replay mode with the given path", xbt_cfgelm_string, 0, 1, _sg_cfg_cb_model_check_replay, NULL); #ifdef HAVE_MC /* do model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check", "Verify the system through model-checking instead of simulating it (EXPERIMENTAL)", xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_model_check, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check", "no"); /* do model-checking-record */ xbt_cfg_register(&_sg_cfg_set, "model-check/record", "Record the model-checking paths", xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_model_check_record, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/record", "no"); /* do stateful model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check/checkpoint", "Specify the amount of steps between checkpoints during stateful model-checking (default: 0 => stateless verification). " "If value=1, one checkpoint is saved for each step => faster verification, but huge memory consumption; higher values are good compromises between speed and memory consumption.", xbt_cfgelm_int, 1, 1, _mc_cfg_cb_checkpoint, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "model-check/checkpoint", 0); /* do stateful model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check/sparse-checkpoint", "Use sparse per-page snapshots.", xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_sparse_checkpoint, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/sparse-checkpoint", "no"); /* do liveness model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check/property", "Specify the name of the file containing the property. It must be the result of the ltl2ba program.", xbt_cfgelm_string, 1, 1, _mc_cfg_cb_property, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "model-check/property", ""); /* do communications determinism model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check/communications_determinism", "Enable/disable the detection of determinism in the communications schemes", xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_comms_determinism, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/communications_determinism", "no"); /* do send determinism model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check/send_determinism", "Enable/disable the detection of send-determinism in the communications schemes", xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_send_determinism, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/send_determinism", "no"); /* Specify the kind of model-checking reduction */ xbt_cfg_register(&_sg_cfg_set, "model-check/reduction", "Specify the kind of exploration reduction (either none or DPOR)", xbt_cfgelm_string, 1, 1, _mc_cfg_cb_reduce, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "model-check/reduction", "dpor"); /* Enable/disable timeout for wait requests with model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check/timeout", "Enable/Disable timeout for wait requests", xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_timeout, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/timeout", "no"); /* Enable/disable global hash computation with model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check/hash", "Enable/Disable state hash for state comparison (exprimental)", xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_hash, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/hash", "no"); /* Set max depth exploration */ /* Currently, this option cannot be used. */ xbt_cfg_register(&_sg_cfg_set, "model-check/snapshot_fds", "Whether file descriptors must be snapshoted", xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_snapshot_fds, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/snapshot_fds", "no"); /* Set max depth exploration */ xbt_cfg_register(&_sg_cfg_set, "model-check/max_depth", "Specify the max depth of exploration (default : 1000)", xbt_cfgelm_int, 1, 1, _mc_cfg_cb_max_depth, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "model-check/max_depth", 1000); /* Set number of visited state stored for state comparison reduction*/ xbt_cfg_register(&_sg_cfg_set, "model-check/visited", "Specify the number of visited state stored for state comparison reduction. If value=5, the last 5 visited states are stored", xbt_cfgelm_int, 1, 1, _mc_cfg_cb_visited, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "model-check/visited", 0); /* Set file name for dot output of graph state */ xbt_cfg_register(&_sg_cfg_set, "model-check/dot_output", "Specify the name of dot file corresponding to graph state", xbt_cfgelm_string, 1, 1, _mc_cfg_cb_dot_output, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "model-check/dot_output", ""); /* Enable/disable non progressive cycles detection with model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check/termination", "Enable/Disable non progressive cycle detection", xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_termination, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/termination", "no"); #endif /* do verbose-exit */ xbt_cfg_register(&_sg_cfg_set, "verbose-exit", "Activate the \"do nothing\" mode in Ctrl-C", xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_verbose_exit, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "verbose-exit", "yes"); /* context factory */ const char *dflt_ctx_fact = "thread"; { char *p = description + sprintf(description, "Context factory to use in SIMIX. Possible values: %s", dflt_ctx_fact); #ifdef CONTEXT_UCONTEXT dflt_ctx_fact = "ucontext"; p += sprintf(p, ", %s", dflt_ctx_fact); #endif #ifdef HAVE_RAWCTX dflt_ctx_fact = "raw"; p += sprintf(p, ", %s", dflt_ctx_fact); #endif sprintf(p, "."); } xbt_cfg_register(&_sg_cfg_set, "contexts/factory", description, xbt_cfgelm_string, 1, 1, _sg_cfg_cb_context_factory, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/factory", dflt_ctx_fact); /* stack size of contexts in KiB */ xbt_cfg_register(&_sg_cfg_set, "contexts/stack_size", "Stack size of contexts in KiB", xbt_cfgelm_int, 1, 1, _sg_cfg_cb_context_stack_size, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/stack_size", 8*1024); /* No, it was not set yet (the above setdefault() changed this to 1). */ smx_context_stack_size_was_set = 0; /* guard size for contexts stacks in memory pages */ 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, NULL); #if defined(_XBT_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); #endif /* No, it was not set yet (the above setdefault() changed this to 1). */ smx_context_guard_size_was_set = 0; /* number of parallel threads for user processes */ xbt_cfg_register(&_sg_cfg_set, "contexts/nthreads", "Number of parallel threads used to execute user contexts", xbt_cfgelm_int, 1, 1, _sg_cfg_cb_contexts_nthreads, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/nthreads", 1); /* minimal number of user contexts to be run in parallel */ xbt_cfg_register(&_sg_cfg_set, "contexts/parallel_threshold", "Minimal number of user contexts to be run in parallel (raw contexts only)", xbt_cfgelm_int, 1, 1, _sg_cfg_cb_contexts_parallel_threshold, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/parallel_threshold", 2); /* synchronization mode for parallel user contexts */ 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, NULL); #ifdef 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"); #endif xbt_cfg_register(&_sg_cfg_set, "network/coordinates", "\"yes\" or \"no\", specifying whether we use a coordinate-based routing (as Vivaldi)", xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb__surf_network_coordinates, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/coordinates", "no"); 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, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "no"); #ifdef 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, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "ns3/TcpModel", "default"); #endif //For smpi/bw_factor and smpi/lat_factor //Default value have to be "threshold0:value0;threshold1:value1;...;thresholdN:valueN" //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. xbt_cfg_register(&_sg_cfg_set, "smpi/bw_factor", "Bandwidth factors for smpi.", xbt_cfgelm_string, 1, 1, NULL, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/bw_factor", "65472:0.940694;15424:0.697866;9376:0.58729;5776:1.08739;3484:0.77493;1426:0.608902;732:0.341987;257:0.338112;0:0.812084"); xbt_cfg_register(&_sg_cfg_set, "smpi/lat_factor", "Latency factors for smpi.", xbt_cfgelm_string, 1, 1, NULL, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/lat_factor", "65472:11.6436;15424:3.48845;9376:2.59299;5776:2.18796;3484:1.88101;1426:1.61075;732:1.9503;257:1.95341;0:2.01467"); xbt_cfg_register(&_sg_cfg_set, "smpi/IB_penalty_factors", "Correction factor to communications using Infiniband model with contention (default value based on Stampede cluster profiling)", xbt_cfgelm_string, 1, 1, NULL, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/IB_penalty_factors", "0.965;0.925;1.35"); #ifdef 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, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/running_power", 20000.0); xbt_cfg_register(&_sg_cfg_set, "smpi/display_timing", "Boolean indicating whether we should display the timing after simulation.", xbt_cfgelm_boolean, 1, 1, NULL, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/display_timing", "no"); xbt_cfg_register(&_sg_cfg_set, "smpi/simulate_computation", "Boolean indicating whether the computational part of the simulated application should be simulated.", xbt_cfgelm_boolean, 1, 1, NULL, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/simulate_computation", "yes"); xbt_cfg_register(&_sg_cfg_set, "smpi/use_shared_malloc", "Boolean indicating whether we should use shared memory when using SMPI_SHARED_MALLOC. Allows user to disable it for debug purposes.", xbt_cfgelm_boolean, 1, 1, NULL, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/use_shared_malloc", "yes"); xbt_cfg_register(&_sg_cfg_set, "smpi/cpu_threshold", "Minimal computation time (in seconds) not discarded, or -1 for infinity.", xbt_cfgelm_double, 1, 1, NULL, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/cpu_threshold", 1e-6); xbt_cfg_register(&_sg_cfg_set, "smpi/async_small_thres", "Maximal size of messages that are to be sent asynchronously, without waiting for the receiver", xbt_cfgelm_int, 1, 1, NULL, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/async_small_thres", 0); xbt_cfg_register(&_sg_cfg_set, "smpi/send_is_detached_thres", "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend", xbt_cfgelm_int, 1, 1, NULL, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/send_is_detached_thres", 65536); xbt_cfg_register(&_sg_cfg_set, "smpi/privatize_global_variables", "Boolean indicating whether we should privatize global variable at runtime.", xbt_cfgelm_boolean, 1, 1, NULL, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/privatize_global_variables", "no"); xbt_cfg_register(&_sg_cfg_set, "smpi/os", "Small messages timings (MPI_Send minimum time for small messages)", xbt_cfgelm_string, 1, 1, NULL, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/os", "1:0:0:0:0"); xbt_cfg_register(&_sg_cfg_set, "smpi/ois", "Small messages timings (MPI_Isend minimum time for small messages)", xbt_cfgelm_string, 1, 1, NULL, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/ois", "1:0:0:0:0"); xbt_cfg_register(&_sg_cfg_set, "smpi/or", "Small messages timings (MPI_Recv minimum time for small messages)", xbt_cfgelm_string, 1, 1, NULL, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/or", "1:0:0:0:0"); xbt_cfg_register(&_sg_cfg_set, "smpi/iprobe", "Minimum time to inject inside a call to MPI_Iprobe", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__iprobe_sleep, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/iprobe", 1e-4); xbt_cfg_register(&_sg_cfg_set, "smpi/test", "Minimum time to inject inside a call to MPI_Test", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__test_sleep, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/test", 1e-4); xbt_cfg_register(&_sg_cfg_set, "smpi/wtime", "Minimum time to inject inside a call to MPI_Wtime", xbt_cfgelm_double, 1, 1, _sg_cfg_cb__wtime_sleep, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/wtime", 0.0); xbt_cfg_register(&_sg_cfg_set, "smpi/coll_selector", "Which collective selector to use", xbt_cfgelm_string, 1, 1, NULL, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/coll_selector", "default"); xbt_cfg_register(&_sg_cfg_set, "smpi/gather", "Which collective to use for gather", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_gather, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/allgather", "Which collective to use for allgather", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allgather, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/barrier", "Which collective to use for barrier", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_barrier, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/reduce_scatter", "Which collective to use for reduce_scatter", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce_scatter, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/scatter", "Which collective to use for scatter", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_scatter, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/allgatherv", "Which collective to use for allgatherv", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allgatherv, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/allreduce", "Which collective to use for allreduce", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allreduce, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/alltoall", "Which collective to use for alltoall", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_alltoall, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/alltoallv", "Which collective to use for alltoallv", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_alltoallv, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/bcast", "Which collective to use for bcast", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_bcast, NULL); xbt_cfg_register(&_sg_cfg_set, "smpi/reduce", "Which collective to use for reduce", xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce, NULL); #endif // HAVE_SMPI xbt_cfg_register(&_sg_cfg_set, "exception/cutpath", "\"yes\" or \"no\". \"yes\" will cut all path information from call traces, used e.g. in exceptions.", xbt_cfgelm_boolean, 1, 1, NULL, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "exception/cutpath", "no"); xbt_cfg_register(&_sg_cfg_set, "clean_atexit", "\"yes\" or \"no\". \"yes\" enables all the cleanups of SimGrid (XBT,SIMIX,MSG) to be registered with atexit. \"no\" may be useful if your code segfaults when calling the exit function.", xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_clean_atexit, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "clean_atexit", "yes"); if (!surf_path) { /* retrieves the current directory of the current process */ const char *initial_path = __surf_get_initial_path(); xbt_assert((initial_path), "__surf_get_initial_path() failed! Can't resolve current Windows directory"); surf_path = xbt_dynar_new(sizeof(char *), NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "path", initial_path); } xbt_cfg_check(_sg_cfg_set); _sg_cfg_init_status = 1; 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"); } }
// TODO, check if this shortcut is really necessary int offset() const { xbt_assert(this->has_offset_location()); return this->location_expression[0].number; }