From 0afad4b7e2215154531cd6b2933af898ec6b781d Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Wed, 27 Dec 2017 00:29:25 +0100 Subject: [PATCH] get rid of the vm_params struct this migration related stuff is now part of the plugin (which grows) the set/get parameters for VM have thus been removed some examples have been simplified in the process has they created VM with useless parameters (no migration) --- examples/java/energy/vm/EnergyVMRunner.java | 20 +++---- .../cloud-masterworker.tesh | 4 -- .../msg/cloud-migration/cloud-migration.tesh | 6 -- examples/msg/energy-vm/energy-vm.c | 4 +- .../s4u/cloud-capping/s4u-cloud-capping.cpp | 3 - .../s4u/cloud-capping/s4u-cloud-capping.tesh | 1 - .../s4u/cloud-simple/s4u-cloud-simple.cpp | 3 - .../s4u/cloud-simple/s4u-cloud-simple.tesh | 2 - include/simgrid/datatypes.h | 22 -------- include/simgrid/msg.h | 2 - include/simgrid/plugins/live_migration.h | 8 +++ include/simgrid/s4u/VirtualMachine.hpp | 2 - src/msg/msg_vm.cpp | 46 ++++------------ src/plugins/vm/VirtualMachineImpl.cpp | 10 ---- src/plugins/vm/VirtualMachineImpl.hpp | 4 -- src/plugins/vm/VmLiveMigration.cpp | 21 ++++--- src/plugins/vm/s4u_VirtualMachine.cpp | 11 ---- src/surf/plugins/dirty_page_tracking.cpp | 55 ++++++++++++++++++- .../msg/cloud-capping/cloud-capping.tesh | 1 - teshsuite/msg/cloud-simple/cloud-simple.tesh | 2 - .../host_on_off_processes.c | 9 +-- tools/cmake/DefinePackages.cmake | 1 - 22 files changed, 97 insertions(+), 140 deletions(-) delete mode 100644 include/simgrid/datatypes.h diff --git a/examples/java/energy/vm/EnergyVMRunner.java b/examples/java/energy/vm/EnergyVMRunner.java index 62e359da1a..1fbb13b1f7 100644 --- a/examples/java/energy/vm/EnergyVMRunner.java +++ b/examples/java/energy/vm/EnergyVMRunner.java @@ -47,10 +47,10 @@ public class EnergyVMRunner extends Process { Host host3 = Host.getByName("MyHost3"); Msg.info("Creating and starting two VMs"); - VM vmHost1 = new VM(host1, "vmHost1", 2048, 10, 50); + VM vmHost1 = new VM(host1, "vmHost1"); vmHost1.start(); - VM vmHost2 = new VM(host2, "vmHost3", 2048, 10, 50); + VM vmHost2 = new VM(host2, "vmHost3"); vmHost2.start(); Msg.info("Create two tasks on Host1: one inside a VM, the other directly on the host"); @@ -58,20 +58,20 @@ public class EnergyVMRunner extends Process { new DummyProcess (vmHost1, "p12").start(); Msg.info("Create two tasks on Host2: both directly on the host"); - new DummyProcess (vmHost2, "p21").start(); - new DummyProcess (host2, "p22").start(); + new DummyProcess (vmHost2, "p21").start(); + new DummyProcess (host2, "p22").start(); Msg.info("Create two tasks on Host3: both inside a VM"); - new DummyProcess (host3, "p31").start(); - new DummyProcess (host3, "p312").start(); + new DummyProcess (host3, "p31").start(); + new DummyProcess (host3, "p312").start(); Msg.info("Wait 5 seconds. The tasks are still running (they run for 3 seconds, but 2 tasks are co-located, " + "so they run for 6 seconds)"); - waitFor(5); + waitFor(5); Msg.info("Wait another 5 seconds. The tasks stop at some point in between"); - waitFor(5); + waitFor(5); - vmHost1.destroy(); - vmHost2.destroy(); + vmHost1.destroy(); + vmHost2.destroy(); } } diff --git a/examples/msg/cloud-masterworker/cloud-masterworker.tesh b/examples/msg/cloud-masterworker/cloud-masterworker.tesh index a83825c92b..4490cb95fa 100644 --- a/examples/msg/cloud-masterworker/cloud-masterworker.tesh +++ b/examples/msg/cloud-masterworker/cloud-masterworker.tesh @@ -41,12 +41,8 @@ $ $SG_TEST_EXENV ${bindir:=.}/cloud-masterworker$EXEEXT --log=no_loc ${platfdir} > [VM00:WRK02:(4) 10.280841] [msg_test/INFO] WRK02 executed task(Task02) > [VM01:WRK03:(5) 10.361121] [msg_test/INFO] WRK03 received task(Task03) from mailbox(MBOX:WRK03) > [node-0.acme.org:master:(1) 10.361121] [msg_test/INFO] # Migrate all VMs to PM(node-1.acme.org) -> [node-1.acme.org:__pr_mig_tx:VM00(node-1.acme.org-node-1.acme.org):(7) 10.361121] [vm_live_migration/WARNING] use the default max_downtime value 30ms > [VM01:WRK03:(5) 10.371121] [msg_test/INFO] WRK03 executed task(Task03) -> [node-10.acme.org:__pr_mig_tx:VM01(node-10.acme.org-node-1.acme.org):(9) 19.682922] [vm_live_migration/WARNING] use the default max_downtime value 30ms > [node-0.acme.org:master:(1) 28.561942] [msg_test/INFO] # Migrate all VMs to PM(node-10.acme.org) -> [node-1.acme.org:__pr_mig_tx:VM00(node-1.acme.org-node-10.acme.org):(11) 28.561942] [vm_live_migration/WARNING] use the default max_downtime value 30ms -> [node-1.acme.org:__pr_mig_tx:VM01(node-1.acme.org-node-10.acme.org):(13) 37.440963] [vm_live_migration/WARNING] use the default max_downtime value 30ms > [node-0.acme.org:master:(1) 46.319984] [msg_test/INFO] # Shutdown the half of worker processes gracefully. The remaining half will be forcibly killed. > [VM00:WRK00:(2) 46.327790] [msg_test/INFO] WRK00 received task(finalize) from mailbox(MBOX:WRK00) > [VM01:WRK01:(3) 46.335596] [msg_test/INFO] WRK01 received task(finalize) from mailbox(MBOX:WRK01) diff --git a/examples/msg/cloud-migration/cloud-migration.tesh b/examples/msg/cloud-migration/cloud-migration.tesh index f76685234e..6f32cff5da 100644 --- a/examples/msg/cloud-migration/cloud-migration.tesh +++ b/examples/msg/cloud-migration/cloud-migration.tesh @@ -1,18 +1,12 @@ $ $SG_TEST_EXENV ${bindir:=.}/cloud-migration ${platfdir}/small_platform.xml --log=no_loc "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" > [ 0.000000] (1:master_@Fafard) Test: Migrate a VM with 1000 Mbytes RAM -> [ 0.000000] (3:__pr_mig_tx:VM0(Fafard-Tremblay)@Fafard) use the default max_downtime value 30ms > [132.765801] (1:master_@Fafard) VM0 migrated: Fafard->Tremblay in 132.766 s > [132.765801] (1:master_@Fafard) Test: Migrate a VM with 100 Mbytes RAM -> [132.765801] (5:__pr_mig_tx:VM0(Fafard-Tremblay)@Fafard) use the default max_downtime value 30ms > [146.111793] (1:master_@Fafard) VM0 migrated: Fafard->Tremblay in 13.346 s > [146.111793] (1:master_@Fafard) Test: Migrate two VMs at once from PM0 to PM1 -> [146.111793] (8:__pr_mig_tx:VM0(Fafard-Tremblay)@Fafard) use the default max_downtime value 30ms -> [146.111793] (11:__pr_mig_tx:VM1(Fafard-Tremblay)@Fafard) use the default max_downtime value 30ms > [411.566271] (9:mig_wrk@Fafard) VM1 migrated: Fafard->Tremblay in 265.454 s > [411.566271] (6:mig_wrk@Fafard) VM0 migrated: Fafard->Tremblay in 265.454 s > [10146.111793] (1:master_@Fafard) Test: Migrate two VMs at once to different PMs -> [10146.111793] (14:__pr_mig_tx:VM0(Fafard-Tremblay)@Fafard) use the default max_downtime value 30ms -> [10146.111793] (17:__pr_mig_tx:VM1(Fafard-Bourassa)@Fafard) use the default max_downtime value 30ms > [10362.620589] (15:mig_wrk@Fafard) VM1 migrated: Fafard->Bourassa in 216.509 s > [10411.547334] (12:mig_wrk@Fafard) VM0 migrated: Fafard->Tremblay in 265.436 s > [20146.111793] (0:maestro@) Bye (simulation time 20146.1) diff --git a/examples/msg/energy-vm/energy-vm.c b/examples/msg/energy-vm/energy-vm.c index 1bdd14b87f..e1d9bb65a9 100644 --- a/examples/msg/energy-vm/energy-vm.c +++ b/examples/msg/energy-vm/energy-vm.c @@ -25,9 +25,9 @@ static int dvfs(int argc, char *argv[]) /* Host 1 */ XBT_INFO("Creating and starting two VMs"); - msg_vm_t vm_host1 = MSG_vm_create(host1, "vm_host1", 1, 2048, 10, 50); + msg_vm_t vm_host1 = MSG_vm_create_core(host1, "vm_host1"); MSG_vm_start(vm_host1); - msg_vm_t vm_host2 = MSG_vm_create(host2, "vm_host2", 1, 2048, 10, 50); + msg_vm_t vm_host2 = MSG_vm_create_core(host2, "vm_host2"); MSG_vm_start(vm_host2); XBT_INFO("Create two tasks on Host1: both inside a VM"); diff --git a/examples/s4u/cloud-capping/s4u-cloud-capping.cpp b/examples/s4u/cloud-capping/s4u-cloud-capping.cpp index fd0d627264..e8a9ec2c01 100644 --- a/examples/s4u/cloud-capping/s4u-cloud-capping.cpp +++ b/examples/s4u/cloud-capping/s4u-cloud-capping.cpp @@ -207,9 +207,6 @@ static void master_main() vm0->destroy(); vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1); - s_vm_params_t params; - memset(¶ms, 0, sizeof(params)); - vm0->setParameters(¶ms); vm0->setRamsize(1e9); // 1GB vm0->start(); diff --git a/examples/s4u/cloud-capping/s4u-cloud-capping.tesh b/examples/s4u/cloud-capping/s4u-cloud-capping.tesh index 383edb709d..e3eb60f33c 100644 --- a/examples/s4u/cloud-capping/s4u-cloud-capping.tesh +++ b/examples/s4u/cloud-capping/s4u-cloud-capping.tesh @@ -175,7 +175,6 @@ $ $SG_TEST_EXENV ${bindir:=.}/s4u-cloud-capping ${platfdir}/small_platform.xml - > [51100.000000] (88:worker0@VM0) not bound => duration 100.000000 (7629600.000000 flops/s) > [52000.000000] (1:master_@Fafard) > [52000.000000] (1:master_@Fafard) # 10. (c) migrate -> [52000.000000] (90:__pr_mig_tx:VM0(Fafard-Fafard)@Fafard) use the default max_downtime value 30ms > [52002.070722] (1:master_@Fafard) > [52002.070722] (1:master_@Fafard) # 10. (d) Put a task again on the VM. > [52102.070722] (91:worker0@VM0) not bound => duration 100.000000 (7629600.000000 flops/s) diff --git a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp index 61f0bd75a7..4f6cca5345 100644 --- a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp +++ b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp @@ -193,9 +193,6 @@ static void master_main() " network one"); XBT_INFO("### Relocate VM0 between PM0 and PM1"); vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1); - s_vm_params_t params; - memset(¶ms, 0, sizeof(params)); - vm0->setParameters(¶ms); vm0->setRamsize(1L * 1024 * 1024 * 1024); // 1GiB vm0->start(); diff --git a/examples/s4u/cloud-simple/s4u-cloud-simple.tesh b/examples/s4u/cloud-simple/s4u-cloud-simple.tesh index 8717fffbc4..a764a8c9b5 100644 --- a/examples/s4u/cloud-simple/s4u-cloud-simple.tesh +++ b/examples/s4u/cloud-simple/s4u-cloud-simple.tesh @@ -51,8 +51,6 @@ $ $SG_TEST_EXENV ${bindir:=.}/s4u-cloud-simple$EXEEXT --log=no_loc ${platfdir:=. > [Fafard:master_:(1) 49.000000] [s4u_test/INFO] ## Test 5 (ended) > [Fafard:master_:(1) 49.000000] [s4u_test/INFO] ## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the network one > [Fafard:master_:(1) 49.000000] [s4u_test/INFO] ### Relocate VM0 between PM0 and PM1 -> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 49.010000] [vm_live_migration/WARNING] use the default max_downtime value 30ms > [Bourassa:comm_rx:(36) 49.204993] [s4u_test/INFO] VM0:comm_tx to Bourassa:comm_rx => 0.204993 sec -> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(40) 191.674258] [vm_live_migration/WARNING] use the default max_downtime value 30ms > [Fafard:master_:(1) 339.199251] [s4u_test/INFO] ## Test 6 (ended) > [339.199251] [s4u_test/INFO] Simulation time 339.199 diff --git a/include/simgrid/datatypes.h b/include/simgrid/datatypes.h deleted file mode 100644 index facacb4749..0000000000 --- a/include/simgrid/datatypes.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2013-2015. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifndef SIMGRID_DATATYPES_H_ -#define SIMGRID_DATATYPES_H_ - -#include "simgrid/forward.h" - -struct vm_params { - double max_downtime; - 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; - -#endif /* SIMGRID_DATATYPES_H_ */ diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index dde50778ed..eadc8626d8 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -463,8 +463,6 @@ XBT_PUBLIC(int) MSG_vm_is_migrating(msg_vm_t vm); XBT_PUBLIC(int) MSG_vm_is_suspended(msg_vm_t vm); XBT_PUBLIC(const char*) MSG_vm_get_name(msg_vm_t vm); -XBT_PUBLIC(void) MSG_vm_get_params(msg_vm_t vm, vm_params_t params); -XBT_PUBLIC(void) MSG_vm_set_params(msg_vm_t vm, vm_params_t params); XBT_PUBLIC(void) MSG_vm_set_ramsize(msg_vm_t vm, size_t size); XBT_PUBLIC(size_t) MSG_vm_get_ramsize(msg_vm_t vm); diff --git a/include/simgrid/plugins/live_migration.h b/include/simgrid/plugins/live_migration.h index 8fa1b7b58c..24425cc81f 100644 --- a/include/simgrid/plugins/live_migration.h +++ b/include/simgrid/plugins/live_migration.h @@ -17,6 +17,14 @@ XBT_PUBLIC(void) sg_vm_start_dirty_page_tracking(sg_vm_t vm); XBT_PUBLIC(void) sg_vm_stop_dirty_page_tracking(sg_vm_t vm); XBT_PUBLIC(double) sg_vm_lookup_computed_flops(sg_vm_t vm); XBT_PUBLIC(void) sg_vm_migrate(sg_vm_t vm, sg_host_t dst_pm); +XBT_PUBLIC(int) sg_vm_is_migratable(sg_vm_t vm); +XBT_PUBLIC(void) sg_vm_set_dirty_page_intensity(sg_vm_t vm, double intensity); +XBT_PUBLIC(double) sg_vm_get_dirty_page_intensity(sg_vm_t vm); +XBT_PUBLIC(void) sg_vm_set_working_set_memory(sg_vm_t vm, sg_size_t size); +XBT_PUBLIC(sg_size_t) sg_vm_get_working_set_memory(sg_vm_t vm); +XBT_PUBLIC(void) sg_vm_set_migration_speed(sg_vm_t vm, double speed); +XBT_PUBLIC(double) sg_vm_get_migration_speed(sg_vm_t vm); +XBT_PUBLIC(double) sg_vm_get_max_downtime(sg_vm_t vm); #define MSG_vm_live_migration_plugin_init() sg_vm_live_migration_plugin_init() #define MSG_vm_migrate(vm, dst_pm) sg_vm_migrate(vm, dst_pm) diff --git a/include/simgrid/s4u/VirtualMachine.hpp b/include/simgrid/s4u/VirtualMachine.hpp index 3510e78ce2..49c44559f9 100644 --- a/include/simgrid/s4u/VirtualMachine.hpp +++ b/include/simgrid/s4u/VirtualMachine.hpp @@ -52,8 +52,6 @@ public: bool isMigrating(); - void getParameters(vm_params_t params); - void setParameters(vm_params_t params); simgrid::s4u::Host* getPm(); void setPm(simgrid::s4u::Host * pm); size_t getRamsize(); diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index c43ab8db24..ce2030b122 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -37,28 +37,6 @@ msg_host_t MSG_vm_get_pm(msg_vm_t vm) return vm->getPm(); } -/** \ingroup m_vm_management - * \brief Set the parameters of a given host - * - * \param vm a vm - * \param params a parameter object - */ -void MSG_vm_set_params(msg_vm_t vm, vm_params_t params) -{ - vm->setParameters(params); -} - -/** \ingroup m_vm_management - * \brief Get the parameters of a given host - * - * \param vm the vm you are interested into - * \param params a prameter object - */ -void MSG_vm_get_params(msg_vm_t vm, vm_params_t params) -{ - vm->getParameters(params); -} - void MSG_vm_set_ramsize(msg_vm_t vm, size_t size) { vm->setRamsize(size); @@ -127,14 +105,16 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char* name, int coreAmount, int rams /* For the moment, intensity_rate is the percentage against the migration bandwidth */ msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount, static_cast(ramsize) * 1024 * 1024); - s_vm_params_t params; - params.max_downtime = 0.03; - params.mig_speed = static_cast(mig_netspeed) * 1024 * 1024; // mig_speed - params.dp_intensity = static_cast(dp_intensity) / 100; - params.dp_cap = vm->getRamsize() * 0.9; // assume working set memory is 90% of ramsize - - XBT_DEBUG("migspeed : %f intensity mem : %d", params.mig_speed, dp_intensity); - vm->setParameters(¶ms); + if (not sg_vm_is_migratable(vm)) { + if (mig_netspeed != 0 || dp_intensity != 0) + XBT_WARN("The live migration is not enabled. dp_intensity and mig_netspeed can't be used"); + } else { + sg_vm_set_dirty_page_intensity(vm, dp_intensity / 100.0); + sg_vm_set_working_set_memory(vm, vm->getRamsize() * 0.9); // assume working set memory is 90% of ramsize + sg_vm_set_migration_speed(vm, mig_netspeed * 1024 * 1024.0); + + XBT_DEBUG("migspeed : %f intensity mem : %d", mig_netspeed * 1024 * 1024.0, dp_intensity); + } return vm; } @@ -150,9 +130,6 @@ msg_vm_t MSG_vm_create_core(msg_host_t pm, const char* name) "Cannot create a VM named %s: this name is already used by an host or a VM", name); msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, 1); - s_vm_params_t params; - memset(¶ms, 0, sizeof(params)); - vm->setParameters(¶ms); return vm; } /** @brief Create a new VM object with the default parameters, but with a specified amount of cores @@ -166,9 +143,6 @@ msg_vm_t MSG_vm_create_multicore(msg_host_t pm, const char* name, int coreAmount "Cannot create a VM named %s: this name is already used by an host or a VM", name); msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount); - s_vm_params_t params; - memset(¶ms, 0, sizeof(params)); - vm->setParameters(¶ms); return vm; } diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index 9ba6c33151..4367a9b74c 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -283,15 +283,5 @@ void VirtualMachineImpl::setBound(double bound) action_->setBound(bound); } -void VirtualMachineImpl::getParams(vm_params_t params) -{ - *params = params_; -} - -void VirtualMachineImpl::setParams(vm_params_t params) -{ - /* may check something here. */ - params_ = *params; -} } } diff --git a/src/plugins/vm/VirtualMachineImpl.hpp b/src/plugins/vm/VirtualMachineImpl.hpp index fb91bd40f4..709ff69224 100644 --- a/src/plugins/vm/VirtualMachineImpl.hpp +++ b/src/plugins/vm/VirtualMachineImpl.hpp @@ -55,9 +55,6 @@ public: virtual void setBound(double bound); - void getParams(vm_params_t params); - void setParams(vm_params_t params); - /* The vm object of the lower layer */ surf::Action* action_ = nullptr; @@ -87,7 +84,6 @@ public: private: simgrid::s4u::Host* hostPM_; - s_vm_params_t params_; int coreAmount_; size_t ramsize_ = 0; e_surf_vm_state_t vmState_ = SURF_VM_STATE_CREATED; diff --git a/src/plugins/vm/VmLiveMigration.cpp b/src/plugins/vm/VmLiveMigration.cpp index 7d8c3b12b6..f0ec4ec59e 100644 --- a/src/plugins/vm/VmLiveMigration.cpp +++ b/src/plugins/vm/VmLiveMigration.cpp @@ -78,15 +78,15 @@ void MigrationRx::operator()() XBT_DEBUG("mig: rx_done"); } -static sg_size_t get_updated_size(double computed, double dp_rate, double dp_cap) +static sg_size_t get_updated_size(double computed, double dp_rate, sg_size_t dp_cap) { - double updated_size = computed * dp_rate; - XBT_DEBUG("updated_size %f dp_rate %f", updated_size, dp_rate); + sg_size_t updated_size = static_cast(computed * dp_rate); + XBT_DEBUG("updated_size %llu dp_rate %f", updated_size, dp_rate); if (updated_size > dp_cap) { updated_size = dp_cap; } - return static_cast(updated_size); + return updated_size; } sg_size_t MigrationTx::sendMigrationData(sg_size_t size, int stage, int stage2_round, double mig_speed, double timeout) @@ -131,13 +131,12 @@ void MigrationTx::operator()() XBT_DEBUG("mig: tx_start"); double host_speed = vm_->getPm()->getSpeed(); - s_vm_params_t params; - vm_->getParameters(¶ms); const sg_size_t ramsize = vm_->getRamsize(); - 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; + const double dp_rate = + host_speed ? (sg_vm_get_migration_speed(vm_) * sg_vm_get_dirty_page_intensity(vm_)) / host_speed : 1; + const sg_size_t dp_cap = sg_vm_get_working_set_memory(vm_); + const double mig_speed = sg_vm_get_migration_speed(vm_); + double max_downtime = sg_vm_get_max_downtime(vm_); double mig_timeout = 10000000.0; bool skip_stage2 = false; @@ -208,7 +207,7 @@ void MigrationTx::operator()() updated_size = get_updated_size(computed, dp_rate, dp_cap); } - XBT_DEBUG("mig-stage 2:%d updated_size %llu computed_during_stage1 %f dp_rate %f dp_cap %f", stage2_round, + XBT_DEBUG("mig-stage 2:%d updated_size %llu computed_during_stage1 %f dp_rate %f dp_cap %llu", stage2_round, updated_size, computed_during_stage1, dp_rate, dp_cap); /* Check whether the remaining size is below the threshold value. If so, move to stage 3. */ diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index 197e4dd71b..403a647e92 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -171,17 +171,6 @@ void VirtualMachine::setBound(double bound) { simgrid::simix::kernelImmediate([this, bound]() { pimpl_vm_->setBound(bound); }); } -/** @brief Retrieve a copy of the parameters of that VM/PM - * @details The ramsize and overcommit fields are used on the PM too */ -void VirtualMachine::getParameters(vm_params_t params) -{ - pimpl_vm_->getParams(params); -} -/** @brief Sets the params of that VM/PM */ -void VirtualMachine::setParameters(vm_params_t params) -{ - simgrid::simix::kernelImmediate([this, params] { pimpl_vm_->setParams(params); }); -} } // namespace simgrid } // namespace s4u diff --git a/src/surf/plugins/dirty_page_tracking.cpp b/src/surf/plugins/dirty_page_tracking.cpp index 329f12396c..e75cb111de 100644 --- a/src/surf/plugins/dirty_page_tracking.cpp +++ b/src/surf/plugins/dirty_page_tracking.cpp @@ -13,7 +13,12 @@ namespace vm { class VmDirtyPageTrackingExt { bool dp_tracking = false; std::map dp_objs; - double dp_updated_by_deleted_tasks = 0; + double dp_updated_by_deleted_tasks = 0.0; + // Percentage of pages that get dirty compared to netspeed [0;1] bytes per 1 flop execution + double dp_intensity = 0.0; + sg_size_t working_set_memory = 0.0; + double max_downtime = 0.03; + double mig_speed = 0.0; public: void startTracking(); @@ -24,6 +29,13 @@ public: double getStoredRemains(kernel::activity::ExecImplPtr exec) { return dp_objs.at(exec); } void updateDirtyPageCount(double delta) { dp_updated_by_deleted_tasks += delta; } double computedFlopsLookup(); + double getIntensity() { return dp_intensity; } + void setIntensity(double intensity) { dp_intensity = intensity; } + double getWorkingSetMemory() { return working_set_memory; } + void setWorkingSetMemory(sg_size_t size) { working_set_memory = size; } + void setMigrationSpeed(double speed) { mig_speed = speed; } + double getMigrationSpeed() { return mig_speed; } + double getMaxDowntime() { return max_downtime; } static simgrid::xbt::Extension EXTENSION_ID; virtual ~VmDirtyPageTrackingExt() = default; @@ -103,6 +115,11 @@ void sg_vm_live_migration_plugin_init() } } +int sg_vm_is_migratable(sg_vm_t vm) +{ + return simgrid::vm::VmDirtyPageTrackingExt::EXTENSION_ID.valid(); +} + void sg_vm_start_dirty_page_tracking(sg_vm_t vm) { vm->pimpl_vm_->extension()->startTracking(); @@ -117,4 +134,40 @@ double sg_vm_lookup_computed_flops(sg_vm_t vm) { return vm->pimpl_vm_->extension()->computedFlopsLookup(); } + +void sg_vm_set_dirty_page_intensity(sg_vm_t vm, double intensity) +{ + vm->pimpl_vm_->extension()->setIntensity(intensity); +} + +double sg_vm_get_dirty_page_intensity(sg_vm_t vm) +{ + return vm->pimpl_vm_->extension()->getIntensity(); +} + +void sg_vm_set_working_set_memory(sg_vm_t vm, sg_size_t size) +{ + vm->pimpl_vm_->extension()->setWorkingSetMemory(size); +} + +sg_size_t sg_vm_get_working_set_memory(sg_vm_t vm) +{ + return vm->pimpl_vm_->extension()->getWorkingSetMemory(); +} + +void sg_vm_set_migration_speed(sg_vm_t vm, double speed) +{ + vm->pimpl_vm_->extension()->setMigrationSpeed(speed); +} + +double sg_vm_get_migration_speed(sg_vm_t vm) +{ + return vm->pimpl_vm_->extension()->getMigrationSpeed(); +} + +double sg_vm_get_max_downtime(sg_vm_t vm) +{ + return vm->pimpl_vm_->extension()->getMaxDowntime(); +} + SG_END_DECL() diff --git a/teshsuite/msg/cloud-capping/cloud-capping.tesh b/teshsuite/msg/cloud-capping/cloud-capping.tesh index 86278aa476..0bd4127549 100644 --- a/teshsuite/msg/cloud-capping/cloud-capping.tesh +++ b/teshsuite/msg/cloud-capping/cloud-capping.tesh @@ -174,7 +174,6 @@ $ $SG_TEST_EXENV ${bindir:=.}/cloud-capping ${platfdir}/small_platform.xml --log > [51100.000000] (88:worker0@VM0) not bound => duration 100.000000 (7629600.000000 flops/s) > [52000.000000] (1:master_@Fafard) > [52000.000000] (1:master_@Fafard) # 10. (c) migrate -> [52000.000000] (90:__pr_mig_tx:VM0(Fafard-Fafard)@Fafard) use the default max_downtime value 30ms > [52002.070722] (1:master_@Fafard) > [52002.070722] (1:master_@Fafard) # 10. (d) Put a task again on the VM. > [52102.070722] (91:worker0@VM0) not bound => duration 100.000000 (7629600.000000 flops/s) diff --git a/teshsuite/msg/cloud-simple/cloud-simple.tesh b/teshsuite/msg/cloud-simple/cloud-simple.tesh index f4f501d1b9..cd26fb6065 100644 --- a/teshsuite/msg/cloud-simple/cloud-simple.tesh +++ b/teshsuite/msg/cloud-simple/cloud-simple.tesh @@ -51,8 +51,6 @@ $ $SG_TEST_EXENV ${bindir:=.}/cloud-simple$EXEEXT --log=no_loc ${platfdir}/small > [Fafard:master_:(1) 49.000000] [msg_test/INFO] ## Test 5 (ended) > [Fafard:master_:(1) 49.000000] [msg_test/INFO] ## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the network one > [Fafard:master_:(1) 49.000000] [msg_test/INFO] ### Relocate VM0 between PM0 and PM1 -> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 49.010000] [vm_live_migration/WARNING] use the default max_downtime value 30ms > [Bourassa:comm_rx:(36) 49.204993] [msg_test/INFO] VM0:comm_tx to Bourassa:comm_rx => 0.204993 sec -> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(40) 191.674258] [vm_live_migration/WARNING] use the default max_downtime value 30ms > [Fafard:master_:(1) 339.199251] [msg_test/INFO] ## Test 6 (ended) > [339.199251] [msg_test/INFO] Bye (simulation time 339.199) diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes.c b/teshsuite/msg/host_on_off_processes/host_on_off_processes.c index cc9d85e000..10ab828b98 100644 --- a/teshsuite/msg/host_on_off_processes/host_on_off_processes.c +++ b/teshsuite/msg/host_on_off_processes/host_on_off_processes.c @@ -180,16 +180,13 @@ static int test_launcher(int argc, char *argv[]) XBT_INFO("Test 6: Turn on Jupiter, assign a VM on Jupiter, launch a process inside the VM, and turn off the node"); // Create VM0 - int dpRate = 70; - msg_vm_t vm0; - msg_process_t daemon; - - vm0 = MSG_vm_create(jupiter, "vm0", 1, 2048, 125, dpRate); + msg_vm_t vm0 = MSG_vm_create_core(jupiter, "vm0"); MSG_vm_start(vm0); argvF = xbt_new(char*, 2); argvF[0] = xbt_strdup("process_daemon"); - daemon = MSG_process_create_with_arguments("process_daemon", process_daemon, NULL, (msg_host_t)vm0, 1, argvF); + msg_process_t daemon = + MSG_process_create_with_arguments("process_daemon", process_daemon, NULL, (msg_host_t)vm0, 1, argvF); argvF = xbt_new(char*, 2); argvF[0] = xbt_strdup("process_daemonJUPI"); diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 97aab8be5b..28db9333b0 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -677,7 +677,6 @@ set(headers_to_install include/simgrid/instr.h include/simgrid/msg.h include/simgrid/simdag.h - include/simgrid/datatypes.h include/simgrid/modelchecker.h include/simgrid/forward.h include/simgrid/simix.h -- 2.20.1