}
void smpi_execute_flops(double flops) {
- smx_activity_t action;
XBT_DEBUG("Handle real computation time: %f flops", flops);
- action = simcall_execution_start("computation", flops, 1, 0);
+ smx_activity_t action = simcall_execution_start("computation", flops, 1, 0);
simcall_set_category (action, TRACE_internal_smpi_get_category());
simcall_execution_wait(action);
smpi_switch_data_segment(smpi_process_index());
extra->type=TRACING_COMPUTING;
extra->comp_size=flops;
TRACE_smpi_computing_in(rank, extra);
+
smpi_execute_flops(flops);
TRACE_smpi_computing_out(rank);
}
}
-bool CpuModel::next_occuring_event_isIdempotent()
-{
- return true;
-}
-
/************
* Resource *
************/
void updateActionsStateLazy(double now, double delta) override;
void updateActionsStateFull(double now, double delta) override;
- bool next_occuring_event_isIdempotent() override;
+ bool next_occuring_event_isIdempotent() {return true;};
};
/************
lmm_variable_mallocator_free_f,
lmm_variable_mallocator_reset_f);
+ l->solve_fun = &lmm_solve;
+
return l;
}
simgrid::surf::ActionLmmListPtr keep_track;
xbt_mallocator_t variable_mallocator;
+
+ void (*solve_fun)(lmm_system_t self);
} s_lmm_system_t;
#define extract_variable(sys) xbt_swag_extract(&(sys->variable_set))
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkCm02Model();
+ surf_network_model = new simgrid::surf::NetworkCm02Model(lagrange_solve);
all_existing_models->push_back(surf_network_model);
lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi);
- surf_network_model->f_networkSolve = lagrange_solve;
xbt_cfg_setdefault_double("network/latency-factor", 10.4);
xbt_cfg_setdefault_double("network/bandwidth-factor", 0.92);
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkCm02Model();
+ surf_network_model = new simgrid::surf::NetworkCm02Model(lagrange_solve);
all_existing_models->push_back(surf_network_model);
lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp, func_reno2_fpi);
- surf_network_model->f_networkSolve = lagrange_solve;
xbt_cfg_setdefault_double("network/latency-factor", 10.4);
xbt_cfg_setdefault_double("network/bandwidth-factor", 0.92);
if (surf_network_model)
return;
- surf_network_model = new simgrid::surf::NetworkCm02Model();
+ surf_network_model = new simgrid::surf::NetworkCm02Model(lagrange_solve);
all_existing_models->push_back(surf_network_model);
lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp, func_vegas_fpi);
- surf_network_model->f_networkSolve = lagrange_solve;
xbt_cfg_setdefault_double("network/latency-factor", 10.4);
xbt_cfg_setdefault_double("network/bandwidth-factor", 0.92);
maxminSystem_->keep_track = modifiedSet_;
}
}
+NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(lmm_system_t self))
+ : NetworkCm02Model()
+{
+ maxminSystem_->solve_fun = specificSolveFun;
+}
+
NetworkCm02Model::~NetworkCm02Model() {}
class NetworkCm02Model : public NetworkModel {
public:
NetworkCm02Model();
+ NetworkCm02Model(void (*solve_fun)(lmm_system_t self));
~NetworkCm02Model();
Link* createLink(const char *name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy,
xbt_dict_t properties) override;
double NetworkModel::next_occuring_event_full(double now)
{
ActionList *runningActions = surf_network_model->getRunningActionSet();
- double minRes = shareResourcesMaxMin(runningActions, maxminSystem_, f_networkSolve);
+ double minRes = shareResourcesMaxMin(runningActions, maxminSystem_);
for(auto it(runningActions->begin()), itend(runningActions->end()); it != itend ; ++it) {
NetworkAction *action = static_cast<NetworkAction*>(&*it);
else
do {
ns3_simulator(now);
- time_to_next_flow_completion = ns3::Simulator::Now().GetSeconds() - surf_get_clock();//FIXME: use now instead ?
+ time_to_next_flow_completion = ns3::Simulator::Now().GetSeconds() - surf_get_clock();
} while(double_equals(time_to_next_flow_completion, 0, sg_surf_precision));
XBT_DEBUG("min : %f", now);
HostL07Model::HostL07Model() : HostModel() {
maxminSystem_ = lmm_system_new(1);
+ maxminSystem_->solve_fun = &bottleneck_solve;
surf_network_model = new NetworkL07Model(this,maxminSystem_);
surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_);
double HostL07Model::next_occuring_event(double /*now*/)
{
ActionList *runningActions = getRunningActionSet();
- double min = shareResourcesMaxMin(runningActions, maxminSystem_, bottleneck_solve);
+ double min = shareResourcesMaxMin(runningActions, maxminSystem_);
for (auto it(runningActions->begin()), itend(runningActions->end()); it != itend ; ++it) {
L07Action *action = static_cast<L07Action*>(&*it);
StorageModel();
~StorageModel();
- /** @brief Create a Storage
- *
- * @param id [description]
- * @param type_id [description]
- * @param content_name [description]
- * @param content_type [description]
- * @param properties [description]
- * @param attach [description]
- * @return The created Storage
- */
virtual Storage *createStorage(const char* id, const char* type_id,
const char* content_name, const char* content_type,
xbt_dict_t properties, const char *attach) = 0;
{
XBT_DEBUG("storage_share_resources");
- double min_completion = shareResourcesMaxMin(getRunningActionSet(), maxminSystem_, lmm_solve);
+ double min_completion = shareResourcesMaxMin(getRunningActionSet(), maxminSystem_);
// Foreach disk
for(auto storage: p_storageList) {
}
double Model::next_occuring_event_full(double /*now*/) {
- return shareResourcesMaxMin(getRunningActionSet(), maxminSystem_, lmm_solve);
+ return shareResourcesMaxMin(getRunningActionSet(), maxminSystem_);
}
-double shareResourcesMaxMin(ActionList *runningActions, lmm_system_t sys, void (*solve) (lmm_system_t))
+double shareResourcesMaxMin(ActionList *runningActions, lmm_system_t sys)
{
- solve(sys);
+ sys->solve_fun(sys);
double min = -1;
for(auto it(runningActions->begin()), itend(runningActions->end()); it != itend ; ++it) {
* Helper functions *
********************/
-double shareResourcesMaxMin(ActionList* runningActions, lmm_system_t sys, void (*solve) (lmm_system_t));
+double shareResourcesMaxMin(ActionList* runningActions, lmm_system_t sys);
/*********