Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix cpu issues with VMs
authorPaul Bédaride <paul.bedaride@gmail.com>
Tue, 4 Feb 2014 15:15:26 +0000 (16:15 +0100)
committerPaul Bédaride <paul.bedaride@gmail.com>
Tue, 4 Feb 2014 15:15:26 +0000 (16:15 +0100)
examples/java/cloud/Cloud.java
examples/msg/cloud/two_tasks_vm.c
examples/msg/cloud/two_tasks_vm.tesh
src/surf/cpu_cas01.cpp
src/surf/cpu_interface.cpp
src/surf/network_constant.cpp
src/surf/storage_n11.cpp
src/surf/surf_interface.cpp

index 333a905..662eb1b 100644 (file)
@@ -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); 
            
index 063eefe..5881fc5 100644 (file)
@@ -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)
index c177793..421c12f 100644 (file)
@@ -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)
index 20241cb..3882724 100644 (file)
@@ -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<CpuCas01ActionPtr>(static_cast<ActionPtr>(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<ActionPtr>(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();
index cd3173e..ee969f9 100644 (file)
@@ -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);
index ed5663f..0ffebc5 100644 (file)
@@ -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)
index 5173ed8..95d8f2b 100644 (file)
@@ -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();
index 1860479..efc5739 100644 (file)
@@ -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) {