From: Paul Bédaride Date: Thu, 24 Oct 2013 09:18:43 +0000 (+0200) Subject: Fix smpi replay issue X-Git-Tag: v3_11_beta~297^2~4 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/8f1e7f3c4954ace560a44b555081b16fa4dab3a0 Fix smpi replay issue --- diff --git a/src/surf/cpu.cpp b/src/surf/cpu.cpp index 7364db1907..fe58cf0af0 100644 --- a/src/surf/cpu.cpp +++ b/src/surf/cpu.cpp @@ -43,7 +43,7 @@ void CpuModel::updateActionsStateLazy(double now, double delta) //without losing the event ascending order (considering all CPU's) double smaller = -1; xbt_swag_foreach(_action, p_runningActionSet) { - action = (ActionLmmPtr) _action; + action = dynamic_cast(static_cast(_action)); if (smaller < 0) { smaller = action->m_lastUpdate; continue; diff --git a/src/surf/cpu.hpp b/src/surf/cpu.hpp index 15e0cec309..5c699826a3 100644 --- a/src/surf/cpu.hpp +++ b/src/surf/cpu.hpp @@ -69,13 +69,15 @@ public: class CpuAction : virtual public Action { public: CpuAction(){}; - CpuAction(ModelPtr model, double cost, bool failed): Action(model, cost, failed) {}; + CpuAction(ModelPtr model, double cost, bool failed) + : Action(model, cost, failed) {}; }; class CpuActionLmm : public ActionLmm, public CpuAction { public: CpuActionLmm(){}; - CpuActionLmm(ModelPtr model, double cost, bool failed): ActionLmm(model, cost, failed), CpuAction(model, cost, failed) {}; + CpuActionLmm(ModelPtr model, double cost, bool failed) + : Action(model, cost, failed), ActionLmm(model, cost, failed), CpuAction(model, cost, failed) {}; void updateRemainingLazy(double now); }; diff --git a/src/surf/network.cpp b/src/surf/network.cpp index 5b1896c700..23a4230ba9 100644 --- a/src/surf/network.cpp +++ b/src/surf/network.cpp @@ -109,7 +109,7 @@ static void net_add_traces(void){ } } -static void net_define_callbacks(void) +void net_define_callbacks(void) { /* Figuring out the network links */ sg_platf_link_add_cb(net_parse_link_init); diff --git a/src/surf/network.hpp b/src/surf/network.hpp index f1b2338759..f51a46e35f 100644 --- a/src/surf/network.hpp +++ b/src/surf/network.hpp @@ -29,7 +29,7 @@ typedef NetworkCm02ActionLmm *NetworkCm02ActionLmmPtr; *********/ extern NetworkCm02ModelPtr surf_network_model; - +void net_define_callbacks(void); /********* * Model * @@ -56,9 +56,9 @@ public: xbt_dynar_t getRoute(RoutingEdgePtr src, RoutingEdgePtr dst); //FIXME: kill field? That is done by the routing nowadays //FIXME: virtual void addTraces() =0; void (*f_networkSolve)(lmm_system_t) = lmm_solve; - double latencyFactor(double size); - double bandwidthFactor(double size); - double bandwidthConstraint(double rate, double bound, double size); + virtual double latencyFactor(double size); + virtual double bandwidthFactor(double size); + virtual double bandwidthConstraint(double rate, double bound, double size); bool m_haveGap = false; }; diff --git a/src/surf/network_smpi.cpp b/src/surf/network_smpi.cpp index 10d2e6247b..b38b3fe3a4 100644 --- a/src/surf/network_smpi.cpp +++ b/src/surf/network_smpi.cpp @@ -71,8 +71,9 @@ void surf_network_model_init_SMPI(void) if (surf_network_model) return; surf_network_model = new NetworkSmpiModel(); - + net_define_callbacks(); xbt_dynar_push(model_list, &surf_network_model); + //network_solve = lmm_solve; xbt_cfg_setdefault_double(_sg_cfg_set, "network/sender_gap", 10e-6); xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); @@ -139,7 +140,7 @@ void NetworkSmpiModel::gapRemove(ActionLmmPtr lmm_action) } } -double NetworkSmpiModel::latencyFactor(double size) +double NetworkSmpiModel::bandwidthFactor(double size) { if (!smpi_bw_factor) smpi_bw_factor = @@ -159,7 +160,7 @@ double NetworkSmpiModel::latencyFactor(double size) return current; } -double NetworkSmpiModel::bandwidthFactor(double size) +double NetworkSmpiModel::latencyFactor(double size) { if (!smpi_lat_factor) smpi_lat_factor = diff --git a/src/surf/network_smpi.hpp b/src/surf/network_smpi.hpp index beae8e2286..f5d38fa3ff 100644 --- a/src/surf/network_smpi.hpp +++ b/src/surf/network_smpi.hpp @@ -7,18 +7,6 @@ class NetworkSmpiModel; typedef NetworkSmpiModel *NetworkSmpiModelPtr; -class NetworkSmpiLink; -typedef NetworkSmpiLink *NetworkSmpiLinkPtr; - -class NetworkSmpiLinkLmm; -typedef NetworkSmpiLinkLmm *NetworkSmpiLinkLmmPtr; - -class NetworkSmpiAction; -typedef NetworkSmpiAction *NetworkSmpiActionPtr; - -class NetworkSmpiActionLmm; -typedef NetworkSmpiActionLmm *NetworkSmpiActionLmmPtr; - /********* * Tools * *********/ @@ -29,7 +17,7 @@ typedef NetworkSmpiActionLmm *NetworkSmpiActionLmmPtr; class NetworkSmpiModel : public NetworkCm02Model { public: - NetworkSmpiModel(){}; + NetworkSmpiModel() : NetworkCm02Model() {m_haveGap=true;}; void gapAppend(double size, const NetworkCm02LinkLmmPtr link, NetworkCm02ActionLmmPtr action); void gapRemove(ActionLmmPtr action); double latencyFactor(double size); @@ -43,29 +31,10 @@ public: * Resource * ************/ -class NetworkSmpiLinkLmm : public NetworkCm02LinkLmm { -public: - NetworkSmpiLinkLmm(NetworkSmpiModelPtr model, const char *name, xbt_dict_t props, - lmm_system_t system, - double constraint_value, - tmgr_history_t history, - e_surf_resource_state_t state_init, - tmgr_trace_t state_trace, - double metric_peak, - tmgr_trace_t metric_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_link_sharing_policy_t policy); -}; - /********** * Action * **********/ -class NetworkSmpiActionLmm : public NetworkCm02ActionLmm { -public: - NetworkSmpiActionLmm(ModelPtr model, double cost, bool failed); -};