Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add few comments - Adrien
authoralebre <adrien.lebre@inria.fr>
Tue, 5 Mar 2013 08:12:33 +0000 (09:12 +0100)
committeralebre <adrien.lebre@inria.fr>
Tue, 5 Mar 2013 08:12:33 +0000 (09:12 +0100)
examples/msg/cloud/masterslave_virtual_machines.c
examples/msg/cloud/simple_vm.c

index dd77241..1431441 100644 (file)
@@ -26,6 +26,9 @@ double task_comm_size = 10000000;
 int master_fun(int argc, char *argv[]);
 int worker_fun(int argc, char *argv[]);
 
 int master_fun(int argc, char *argv[]);
 int worker_fun(int argc, char *argv[]);
 
+int nb_hosts=3;
+//int nb_vms=nb_host*2; // 2 VMs per PM
 static void work_batch(int workers_count)
 {
   int i;
 static void work_batch(int workers_count)
 {
   int i;
@@ -127,8 +130,8 @@ int master_fun(int argc, char *argv[])
     MSG_vm_migrate(vm, pms[1]);
   }
 
     MSG_vm_migrate(vm, pms[1]);
   }
 
-  /* FIXME: Do we need to support cold migration? Yes, but how should
-   * parameters of a migration be passed? */
+  /* Migration with default policy is called (i.e. live migration with pre-copy strategy */
+  /* If you want to use other policy such as post-copy or cold migration, you should add a third parameter that defines the policy */
   XBT_INFO("Migrate all VMs to PM(%s)", MSG_host_get_name(pms[2]));
   xbt_dynar_foreach(vms, i, vm) {
     // MSG_vm_suspend(vm);
   XBT_INFO("Migrate all VMs to PM(%s)", MSG_host_get_name(pms[2]));
   xbt_dynar_foreach(vms, i, vm) {
     // MSG_vm_suspend(vm);
@@ -137,7 +140,7 @@ int master_fun(int argc, char *argv[])
   }
 
 
   }
 
 
-  XBT_INFO("Shutdown the first 10 worker processes gracefuly. The   the second half will forcefully get killed");
+  XBT_INFO("Shutdown the first worker processes gracefuly. The   the second half will forcefully get killed");
   for (i = 0; i < workers_count; i++) {
     char mbox[64];
     sprintf(mbox, "MBOX:WRK%02d", i);
   for (i = 0; i < workers_count; i++) {
     char mbox[64];
     sprintf(mbox, "MBOX:WRK%02d", i);
@@ -206,15 +209,14 @@ int main(int argc, char *argv[])
     printf("Usage: %s example/msg/msg_platform.xml\n", argv[0]);
     return 1;
   }
     printf("Usage: %s example/msg/msg_platform.xml\n", argv[0]);
     return 1;
   }
-
-  /* Load the platform file */
+ /* Load the platform file */
   MSG_create_environment(argv[1]);
 
   MSG_create_environment(argv[1]);
 
-  /* Retrieve the 10 first hosts from the platform file */
+  /* Retrieve the  first hosts from the platform file */
   xbt_dynar_t hosts_dynar = MSG_hosts_as_dynar();
 
   xbt_dynar_t hosts_dynar = MSG_hosts_as_dynar();
 
-  if (xbt_dynar_length(hosts_dynar) <= 10) {
-    XBT_CRITICAL("need 10 hosts");
+  if (xbt_dynar_length(hosts_dynar) <= nb_hosts) {
+    XBT_CRITICAL("need %d hosts", nb_hosts);
     return 1;
   }
 
     return 1;
   }
 
@@ -233,12 +235,12 @@ int main(int argc, char *argv[])
 
     master_argv[i] = xbt_strdup(MSG_host_get_name(host));
 
 
     master_argv[i] = xbt_strdup(MSG_host_get_name(host));
 
-    if (i == 10)
+    if (i == nb_hosts)
       break;
   }
 
 
       break;
   }
 
 
-  MSG_process_create_with_arguments("master", master_fun, NULL, master_pm, 11, master_argv);
+  MSG_process_create_with_arguments("master", master_fun, NULL, master_pm, nb_hosts+1, master_argv);
 
   msg_error_t res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
   msg_error_t res = MSG_main();
   XBT_INFO("Simulation time %g", MSG_get_clock());
index f6ec0c4..046cb93 100644 (file)
@@ -126,6 +126,7 @@ int master_main(int argc, char *argv[])
   msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t);
   msg_vm_t vm0, vm1;
 
   msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t);
   msg_vm_t vm0, vm1;
 
+  XBT_INFO("## Test 1 (started): check computation on normal PM");
   XBT_INFO("### Put a task on a PM");
   launch_computation_worker(pm0);
   MSG_process_sleep(2);
   XBT_INFO("### Put a task on a PM");
   launch_computation_worker(pm0);
   MSG_process_sleep(2);
@@ -139,21 +140,28 @@ int master_main(int argc, char *argv[])
   launch_computation_worker(pm0);
   launch_computation_worker(pm1);
   MSG_process_sleep(2);
   launch_computation_worker(pm0);
   launch_computation_worker(pm1);
   MSG_process_sleep(2);
+  XBT_INFO("## Test 1 (ended)");
 
 
+  XBT_INFO("## Test 2  (started): check impact of running a task inside a VM (there is no degradation for the moment)");
   XBT_INFO("### Put a VM on a PM, and put a task to the VM");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   MSG_vm_start(vm0);
   launch_computation_worker(vm0);
   MSG_process_sleep(2);
   MSG_vm_destroy(vm0);
   XBT_INFO("### Put a VM on a PM, and put a task to the VM");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   MSG_vm_start(vm0);
   launch_computation_worker(vm0);
   MSG_process_sleep(2);
   MSG_vm_destroy(vm0);
-
+  XBT_INFO("## Test 2 (ended)");
+  
+  XBT_INFO("## Test 3  (started): check impact of running a task collocated with a VM (there is no VM noise for the moment)");
   XBT_INFO("### Put a VM on a PM, and put a task to the PM (FIXME: broken)");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   MSG_vm_start(vm0);
   launch_computation_worker(pm0);
   MSG_process_sleep(2);
   MSG_vm_destroy(vm0);
   XBT_INFO("### Put a VM on a PM, and put a task to the PM (FIXME: broken)");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   MSG_vm_start(vm0);
   launch_computation_worker(pm0);
   MSG_process_sleep(2);
   MSG_vm_destroy(vm0);
+  XBT_INFO("## Test 3 (ended)");
 
 
+  XBT_INFO("## Test 4 (started): compare the cost of running two tasks inside two different VMs collocated or not (for the moment, there is no  \
+                                                                                       degradation for the VMs. Hence, the time should be equals to the time of test 1");
   XBT_INFO("### Put two VMs on a PM, and put a task to each VM");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   vm1 = MSG_vm_create_core(pm0, "VM1");
   XBT_INFO("### Put two VMs on a PM, and put a task to each VM");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   vm1 = MSG_vm_create_core(pm0, "VM1");
@@ -175,8 +183,10 @@ int master_main(int argc, char *argv[])
   MSG_process_sleep(2);
   MSG_vm_destroy(vm0);
   MSG_vm_destroy(vm1);
   MSG_process_sleep(2);
   MSG_vm_destroy(vm0);
   MSG_vm_destroy(vm1);
+  XBT_INFO("## Test 4 (ended)");
 
 
-
+  
+  XBT_INFO("## Test 5  (started): Analyse network impact");
   XBT_INFO("### Make a connection between PM0 and PM1");
   launch_communication_worker(pm0, pm1);
   MSG_process_sleep(5);
   XBT_INFO("### Make a connection between PM0 and PM1");
   launch_communication_worker(pm0, pm1);
   MSG_process_sleep(5);
@@ -226,8 +236,10 @@ int master_main(int argc, char *argv[])
   MSG_process_sleep(5);
   MSG_vm_destroy(vm0);
   MSG_vm_destroy(vm1);
   MSG_process_sleep(5);
   MSG_vm_destroy(vm0);
   MSG_vm_destroy(vm1);
+  XBT_INFO("## Test 5 (ended)");
 
 
 
 
+  XBT_INFO("## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the network one");
   XBT_INFO("### Relocate VM0 between PM0 and PM1");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   MSG_vm_start(vm0);
   XBT_INFO("### Relocate VM0 between PM0 and PM1");
   vm0 = MSG_vm_create_core(pm0, "VM0");
   MSG_vm_start(vm0);
@@ -238,7 +250,8 @@ int master_main(int argc, char *argv[])
   MSG_vm_migrate(vm0, pm0);
   MSG_process_sleep(5);
   MSG_vm_destroy(vm0);
   MSG_vm_migrate(vm0, pm0);
   MSG_process_sleep(5);
   MSG_vm_destroy(vm0);
-
+  XBT_INFO("## Test 6 (ended)");
+  
   return 0;
 }
 
   return 0;
 }