Exemplo n.º 1
0
static void vm_migrate(msg_vm_t vm, msg_host_t dst_pm)
{
  msg_host_t src_pm = MSG_vm_get_pm(vm);
  double mig_sta    = MSG_get_clock();
  MSG_vm_migrate(vm, dst_pm);
  double mig_end = MSG_get_clock();

  XBT_INFO("%s migrated: %s->%s in %g s", MSG_vm_get_name(vm), MSG_host_get_name(src_pm), MSG_host_get_name(dst_pm),
           mig_end - mig_sta);
}
Exemplo n.º 2
0
JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_internalmig(JNIEnv *env, jobject jvm, jobject jhost)
{
  msg_vm_t vm = jvm_get_native(env,jvm);
  msg_host_t host = jhost_get_native(env, jhost);
  try {
    MSG_vm_migrate(vm,host);
  }
  catch(xbt_ex& e){
     XBT_VERB("CATCH EXCEPTION MIGRATION %s",e.what());
     jxbt_throw_host_failure(env, (char*)"during migration");
  }
}
Exemplo n.º 3
0
static int master_main(int argc, char *argv[])
{
  msg_host_t pm0 = MSG_host_by_name("Fafard");
  msg_host_t pm1 = MSG_host_by_name("Fafard");

  XBT_INFO("# 1. Put a single task on a PM. ");
  test_one_task(pm0);
  XBT_INFO(" ");

  XBT_INFO("# 2. Put two tasks on a PM.");
  test_two_tasks(pm0, pm0);
  XBT_INFO(" ");

  msg_host_t vm0 = MSG_vm_create_core(pm0, "VM0");
  MSG_vm_start(vm0);

  XBT_INFO("# 3. Put a single task on a VM. ");
  test_one_task(vm0);
  XBT_INFO(" ");

  XBT_INFO("# 4. Put two tasks on a VM.");
  test_two_tasks(vm0, vm0);
  XBT_INFO(" ");

  MSG_vm_destroy(vm0);

  vm0 = MSG_vm_create_core(pm0, "VM0");
  MSG_vm_start(vm0);

  XBT_INFO("# 6. Put a task on a PM and a task on a VM.");
  test_two_tasks(pm0, vm0);
  XBT_INFO(" ");

  MSG_vm_destroy(vm0);

  vm0 = MSG_vm_create_core(pm0, "VM0");
  double cpu_speed = MSG_host_get_speed(pm0);
  MSG_vm_set_bound(vm0, cpu_speed / 10);
  MSG_vm_start(vm0);

  XBT_INFO("# 7. Put a single task on the VM capped by 10%%.");
  test_one_task(vm0);
  XBT_INFO(" ");

  XBT_INFO("# 8. Put two tasks on the VM capped by 10%%.");
  test_two_tasks(vm0, vm0);
  XBT_INFO(" ");

  XBT_INFO("# 9. Put a task on a PM and a task on the VM capped by 10%%.");
  test_two_tasks(pm0, vm0);
  XBT_INFO(" ");

  MSG_vm_destroy(vm0);

  vm0 = MSG_vm_create_core(pm0, "VM0");

  s_vm_params_t params;
  memset(&params, 0, sizeof(params));
  params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes
  MSG_host_set_params(vm0, &params);
  MSG_vm_start(vm0);

  cpu_speed = MSG_host_get_speed(pm0);
  MSG_vm_start(vm0);

  XBT_INFO("# 10. Test migration");
  const double computation_amount = cpu_speed * 10;

  XBT_INFO("# 10. (a) Put a task on a VM without any bound.");
  launch_worker(vm0, "worker0", computation_amount, 0, 0);
  MSG_process_sleep(1000);
  XBT_INFO(" ");

  XBT_INFO("# 10. (b) set 10%% bound to the VM, and then put a task on the VM.");
  MSG_vm_set_bound(vm0, cpu_speed / 10);
  launch_worker(vm0, "worker0", computation_amount, 0, 0);
  MSG_process_sleep(1000);
  XBT_INFO(" ");

  XBT_INFO("# 10. (c) migrate");
  MSG_vm_migrate(vm0, pm1);
  XBT_INFO(" ");

  XBT_INFO("# 10. (d) Put a task again on the VM.");
  launch_worker(vm0, "worker0", computation_amount, 0, 0);
  MSG_process_sleep(1000);
  XBT_INFO(" ");

  MSG_vm_destroy(vm0);

  XBT_INFO("# 11. Change a bound dynamically.");
  test_dynamic_change();

  return 0;
}
Exemplo n.º 4
0
 xbt_dynar_foreach(vms, i, vm) {
   MSG_vm_migrate(vm, worker_pm1);
 }