Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove the skip_stage parameters from VM params
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 6 Dec 2017 13:04:44 +0000 (14:04 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 6 Dec 2017 13:08:56 +0000 (14:08 +0100)
the current migration algorithm has to do the 3 stages dy default, let
assume that. Alternative migration algorithm should be added to the
plugin and the current one moved there too.

include/simgrid/datatypes.h
src/msg/msg_vm.cpp

index 7c5814e..facacb4 100644 (file)
 #include "simgrid/forward.h"
 
 struct vm_params {
-  /* The size of other states than memory pages, which is out-of-scope of dirty page tracking. */
-  int skip_stage1;
-  int skip_stage2;
   double max_downtime;
-
-  double dp_intensity; // Percentage of pages that get dirty compared to netspeed [0;1]
-  double dp_cap; /* bytes per 1 flop execution */
-
-  /* set migration speed */
-  double mig_speed;
+  double dp_intensity; // Percentage of pages that get dirty compared to netspeed [0;1] bytes per 1 flop execution
+  double dp_cap;
+  double mig_speed; // Set migration speed
 };
+
 typedef struct vm_params  s_vm_params_t;
 typedef struct vm_params* vm_params_t;
 
index 7038e56..c6940a6 100644 (file)
@@ -124,8 +124,6 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char* name, int coreAmount, int rams
 
   msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount, static_cast<sg_size_t>(ramsize) * 1024 * 1024);
   s_vm_params_t params;
-  params.skip_stage1  = 0;
-  params.skip_stage2  = 0;
   params.max_downtime = 0.03;
   params.mig_speed    = static_cast<double>(mig_netspeed) * 1024 * 1024; // mig_speed
   params.dp_intensity = static_cast<double>(dp_intensity) / 100;
@@ -523,14 +521,13 @@ static int migration_tx_fun(int argc, char *argv[])
   s_vm_params_t params;
   ms->vm->getParameters(&params);
   const sg_size_t ramsize   = ms->vm->getRamsize();
-  const int skip_stage1     = params.skip_stage1;
-  int skip_stage2           = params.skip_stage2;
   const double dp_rate      = host_speed ? (params.mig_speed * params.dp_intensity) / host_speed : 1;
   const double dp_cap       = params.dp_cap;
   const double mig_speed    = params.mig_speed;
   double max_downtime       = params.max_downtime;
 
   double mig_timeout = 10000000.0;
+  bool skip_stage2   = false;
 
   size_t remaining_size = ramsize;
   size_t threshold      = 0.0;
@@ -549,44 +546,40 @@ static int migration_tx_fun(int argc, char *argv[])
   start_dirty_page_tracking(ms->vm);
 
   double computed_during_stage1 = 0;
-  if (not skip_stage1) {
-    double clock_prev_send = MSG_get_clock();
-
-    try {
-      /* At stage 1, we do not need timeout. We have to send all the memory pages even though the duration of this
-       * transfer exceeds the timeout value. */
-      XBT_VERB("Stage 1: Gonna send %llu bytes", ramsize);
-      sg_size_t sent = send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, ramsize, ms->mbox, 1, 0, mig_speed, -1);
-      remaining_size -= sent;
-      computed_during_stage1 = lookup_computed_flop_counts(ms->vm, 1, 0);
-
-      if (sent < ramsize) {
-        XBT_VERB("mig-stage1: timeout, force moving to stage 3");
-        skip_stage2 = 1;
-      } else if (sent > ramsize)
-        XBT_CRITICAL("bug");
-
-    }
-    catch (xbt_ex& e) {
-      //hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
-      // Stop the dirty page tracking an return (there is no memory space to release)
-      stop_dirty_page_tracking(ms->vm);
-      return 0;
-    }
+  double clock_prev_send        = MSG_get_clock();
 
-    double clock_post_send = MSG_get_clock();
-    mig_timeout -= (clock_post_send - clock_prev_send);
-    if (mig_timeout < 0) {
-      XBT_VERB("The duration of stage 1 exceeds the timeout value, skip stage 2");
-      skip_stage2 = 1;
-    }
+  try {
+    /* At stage 1, we do not need timeout. We have to send all the memory pages even though the duration of this
+     * transfer exceeds the timeout value. */
+    XBT_VERB("Stage 1: Gonna send %llu bytes", ramsize);
+    sg_size_t sent = send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, ramsize, ms->mbox, 1, 0, mig_speed, -1);
+    remaining_size -= sent;
+    computed_during_stage1 = lookup_computed_flop_counts(ms->vm, 1, 0);
+
+    if (sent < ramsize) {
+      XBT_VERB("mig-stage1: timeout, force moving to stage 3");
+      skip_stage2 = true;
+    } else if (sent > ramsize)
+      XBT_CRITICAL("bug");
+
+  } catch (xbt_ex& e) {
+    // hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
+    // Stop the dirty page tracking an return (there is no memory space to release)
+    stop_dirty_page_tracking(ms->vm);
+    return 0;
+  }
 
-    /* estimate bandwidth */
-    double bandwidth = ramsize / (clock_post_send - clock_prev_send);
-    threshold        = bandwidth * max_downtime;
-    XBT_DEBUG("actual bandwidth %f (MB/s), threshold %zu", bandwidth / 1024 / 1024, threshold);
+  double clock_post_send = MSG_get_clock();
+  mig_timeout -= (clock_post_send - clock_prev_send);
+  if (mig_timeout < 0) {
+    XBT_VERB("The duration of stage 1 exceeds the timeout value, skip stage 2");
+    skip_stage2 = true;
   }
 
+  /* estimate bandwidth */
+  double bandwidth = ramsize / (clock_post_send - clock_prev_send);
+  threshold        = bandwidth * max_downtime;
+  XBT_DEBUG("actual bandwidth %f (MB/s), threshold %zu", bandwidth / 1024 / 1024, threshold);
 
   /* Stage2: send update pages iteratively until the size of remaining states becomes smaller than threshold value. */
   if (not skip_stage2) {