From: Paul Bédaride Date: Tue, 4 Feb 2014 15:15:26 +0000 (+0100) Subject: Fix cpu issues with VMs X-Git-Tag: v3_11_beta~91 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/310e28eac7bc0c752880767cd88a66d64ebf04ef Fix cpu issues with VMs --- diff --git a/examples/java/cloud/Cloud.java b/examples/java/cloud/Cloud.java index 333a905561..662eb1b1ea 100644 --- a/examples/java/cloud/Cloud.java +++ b/examples/java/cloud/Cloud.java @@ -17,7 +17,7 @@ import org.simgrid.msg.MsgException; public class Cloud { public static final double task_comp_size = 10; public static final double task_comm_size = 10; - public static final int hostNB = 500 ; + public static final int hostNB = 89 ; public static void main(String[] args) throws MsgException { Msg.init(args); diff --git a/examples/msg/cloud/two_tasks_vm.c b/examples/msg/cloud/two_tasks_vm.c index 063eefefca..5881fc5c36 100644 --- a/examples/msg/cloud/two_tasks_vm.c +++ b/examples/msg/cloud/two_tasks_vm.c @@ -64,10 +64,10 @@ static int master_main(int argc, char *argv[]) msg_host_t pm0 = xbt_dynar_get_as(hosts_dynar, 0, msg_host_t); msg_vm_t vm0; vm0 = MSG_vm_create_core(pm0, "VM0"); - + MSG_vm_start(vm0); //MSG_process_sleep(1); - launch_computation_worker(pm0); + launch_computation_worker(vm0); while(MSG_get_clock()<100) { if (atask != NULL) diff --git a/examples/msg/cloud/two_tasks_vm.tesh b/examples/msg/cloud/two_tasks_vm.tesh index c177793aa5..421c12f588 100644 --- a/examples/msg/cloud/two_tasks_vm.tesh +++ b/examples/msg/cloud/two_tasks_vm.tesh @@ -4,7 +4,7 @@ p Testing a vm with two successive tasks $ $SG_TEST_EXENV two_tasks_vm$EXEEXT ${srcdir:=.}/simple_plat.xml > [0.000000] [surf_vm_workstation/INFO] Create VM(VM0)@PM(PM0) with 0 mounted disks -> [PM0:compute:(2) 0.000000] [msg_test/INFO] PM0:compute task 1 created 0 +> [VM0:compute:(2) 0.000000] [msg_test/INFO] VM0:compute task 1 created 0 > [PM0:master_:(1) 0.000000] [msg_test/INFO] aTask remaining duration: 1e+09 > [PM0:master_:(1) 1.000000] [msg_test/INFO] aTask remaining duration: 9e+08 > [PM0:master_:(1) 2.000000] [msg_test/INFO] aTask remaining duration: 8e+08 @@ -15,9 +15,9 @@ $ $SG_TEST_EXENV two_tasks_vm$EXEEXT ${srcdir:=.}/simple_plat.xml > [PM0:master_:(1) 7.000000] [msg_test/INFO] aTask remaining duration: 3e+08 > [PM0:master_:(1) 8.000000] [msg_test/INFO] aTask remaining duration: 2e+08 > [PM0:master_:(1) 9.000000] [msg_test/INFO] aTask remaining duration: 1e+08 -> [PM0:compute:(2) 10.000000] [msg_test/INFO] PM0:compute task 1 executed 10 +> [VM0:compute:(2) 10.000000] [msg_test/INFO] VM0:compute task 1 executed 10 > [PM0:master_:(1) 10.000000] [msg_test/INFO] aTask remaining duration: 0 -> [PM0:compute:(2) 11.000000] [msg_test/INFO] PM0:compute task 2 created 11 +> [VM0:compute:(2) 11.000000] [msg_test/INFO] VM0:compute task 2 created 11 > [PM0:master_:(1) 12.000000] [msg_test/INFO] aTask remaining duration: 9.9e+09 > [PM0:master_:(1) 13.000000] [msg_test/INFO] aTask remaining duration: 9.8e+09 > [PM0:master_:(1) 14.000000] [msg_test/INFO] aTask remaining duration: 9.7e+09 @@ -106,5 +106,5 @@ $ $SG_TEST_EXENV two_tasks_vm$EXEEXT ${srcdir:=.}/simple_plat.xml > [PM0:master_:(1) 97.000000] [msg_test/INFO] aTask remaining duration: 1.4e+09 > [PM0:master_:(1) 98.000000] [msg_test/INFO] aTask remaining duration: 1.3e+09 > [PM0:master_:(1) 99.000000] [msg_test/INFO] aTask remaining duration: 1.2e+09 -> [PM0:compute:(2) 111.000000] [msg_test/INFO] PM0:compute task 2 executed 100 +> [VM0:compute:(2) 111.000000] [msg_test/INFO] VM0:compute task 2 executed 100 > [10100.000000] [msg_test/INFO] Bye (simulation time 10100) diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 20241cba1b..3882724a4e 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -231,7 +231,7 @@ void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double d xbt_assert(m_core == 1, "FIXME: add power scaling code also for constraint_core[i]"); m_powerScale = value; - lmm_update_constraint_bound(surf_cpu_model_pm->getMaxminSystem(), getConstraint(), + lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(), m_core * m_powerScale * m_powerPeak); #ifdef HAVE_TRACING @@ -240,10 +240,10 @@ void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double d m_powerPeak); #endif while ((var = lmm_get_var_from_cnst - (surf_cpu_model_pm->getMaxminSystem(), getConstraint(), &elem))) { + (getModel()->getMaxminSystem(), getConstraint(), &elem))) { CpuCas01ActionPtr action = static_cast(static_cast(lmm_variable_id(var))); - lmm_update_variable_bound(surf_cpu_model_pm->getMaxminSystem(), + lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), m_powerScale * m_powerPeak); } @@ -262,7 +262,7 @@ void CpuCas01::updateState(tmgr_trace_event_t event_type, double value, double d setState(SURF_RESOURCE_OFF); - while ((var = lmm_get_var_from_cnst(surf_cpu_model_pm->getMaxminSystem(), cnst, &elem))) { + while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), cnst, &elem))) { ActionPtr action = static_cast(lmm_variable_id(var)); if (action->getState() == SURF_ACTION_RUNNING || @@ -287,7 +287,7 @@ CpuActionPtr CpuCas01::execute(double size) { XBT_IN("(%s,%g)", getName(), size); - CpuCas01ActionPtr action = new CpuCas01Action(surf_cpu_model_pm, size, getState() != SURF_RESOURCE_ON, + CpuCas01ActionPtr action = new CpuCas01Action(getModel(), size, getState() != SURF_RESOURCE_ON, m_powerScale * m_powerPeak, getConstraint()); XBT_OUT(); @@ -300,7 +300,7 @@ CpuActionPtr CpuCas01::sleep(double duration) duration = MAX(duration, MAXMIN_PRECISION); XBT_IN("(%s,%g)", getName(), duration); - CpuCas01ActionPtr action = new CpuCas01Action(surf_cpu_model_pm, 1.0, getState() != SURF_RESOURCE_ON, + CpuCas01ActionPtr action = new CpuCas01Action(getModel(), 1.0, getState() != SURF_RESOURCE_ON, m_powerScale * m_powerPeak, getConstraint()); @@ -315,14 +315,14 @@ CpuActionPtr CpuCas01::sleep(double duration) action->getStateSet()->push_back(*action); } - lmm_update_variable_weight(surf_cpu_model_pm->getMaxminSystem(), + lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), 0.0); - if (surf_cpu_model_pm->getUpdateMechanism() == UM_LAZY) { // remove action from the heap - action->heapRemove(surf_cpu_model_pm->getActionHeap()); + if (getModel()->getUpdateMechanism() == UM_LAZY) { // remove action from the heap + action->heapRemove(getModel()->getActionHeap()); // this is necessary for a variable with weight 0 since such // variables are ignored in lmm and we need to set its max_duration // correctly at the next call to share_resources - surf_cpu_model_pm->getModifiedSet()->push_front(*action); + getModel()->getModifiedSet()->push_front(*action); } XBT_OUT(); diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index cd3173e522..ee969f9c4a 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -106,7 +106,7 @@ void CpuModel::updateActionsStateFull(double now, double delta) action->updateMaxDuration(delta); - if ((action->getRemains() <= 0) && + if ((action->getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) { action->finish(); action->setState(SURF_ACTION_DONE); diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index ed5663f661..0ffebc5686 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -61,7 +61,7 @@ void NetworkConstantModel::updateActionsState(double /*now*/, double delta) if (action->getMaxDuration() != NO_MAX_DURATION) action->updateMaxDuration(delta); - if (action->getRemains() <= 0) { + if (action->getRemainsNoUpdate() <= 0) { action->finish(); action->setState(SURF_ACTION_DONE); } else if ((action->getMaxDuration() != NO_MAX_DURATION) diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 5173ed84d5..95d8f2b829 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -321,13 +321,13 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta) if (action->getMaxDuration() != NO_MAX_DURATION) action->updateMaxDuration(delta); - if(action->getRemains() > 0 && + if(action->getRemainsNoUpdate() > 0 && lmm_get_variable_weight(action->getVariable()) > 0 && action->p_storage->m_usedSize == action->p_storage->m_size) { action->finish(); action->setState(SURF_ACTION_FAILED); - } else if ((action->getRemains() <= 0) && + } else if ((action->getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) { action->finish(); diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 186047977b..efc5739cec 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -537,7 +537,7 @@ double Model::shareResourcesLazy(double now) value = lmm_variable_getvalue(action->getVariable()); if (value > 0) { if (action->getRemains() > 0) { - value = action->getRemains() / value; + value = action->getRemainsNoUpdate() / value; min = now + value; } else { value = 0.0; @@ -604,7 +604,7 @@ double Model::shareResourcesMaxMin(ActionListPtr running_actions, if (value > 0) { if (action->getRemains() > 0) - min = action->getRemains() / value; + min = action->getRemainsNoUpdate() / value; else min = 0.0; if ((action->getMaxDuration() >= 0) && (action->getMaxDuration() < min)) @@ -618,7 +618,7 @@ double Model::shareResourcesMaxMin(ActionListPtr running_actions, value = lmm_variable_getvalue(action->getVariable()); if (value > 0) { if (action->getRemains() > 0) - value = action->getRemains() / value; + value = action->getRemainsNoUpdate() / value; else value = 0.0; if (value < min) {