From: Frederic Suter Date: Wed, 6 Dec 2017 13:04:44 +0000 (+0100) Subject: remove the skip_stage parameters from VM params X-Git-Tag: v3.18~122 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6b40140ea8cf1c9e249827d3aed6181b9528d1cf?hp=2bfd59feb2da75a1eabaac5e6727a9dd2a8bb7d4 remove the skip_stage parameters from VM params 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. --- diff --git a/include/simgrid/datatypes.h b/include/simgrid/datatypes.h index 7c5814e7fd..facacb4749 100644 --- a/include/simgrid/datatypes.h +++ b/include/simgrid/datatypes.h @@ -10,17 +10,12 @@ #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; diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 7038e5638f..c6940a6888 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -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(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(mig_netspeed) * 1024 * 1024; // mig_speed params.dp_intensity = static_cast(dp_intensity) / 100; @@ -523,14 +521,13 @@ static int migration_tx_fun(int argc, char *argv[]) s_vm_params_t params; ms->vm->getParameters(¶ms); 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) {