Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 9 Feb 2016 20:38:23 +0000 (21:38 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 9 Feb 2016 20:39:19 +0000 (21:39 +0100)
src/simix/smx_host.cpp
src/surf/host_ptask_L07.hpp
src/surf/surf_c_bindings.cpp

index b362a16..592a101 100644 (file)
@@ -10,6 +10,7 @@
 #include "xbt/dict.h"
 #include "mc/mc.h"
 #include "src/mc/mc_replay.h"
 #include "xbt/dict.h"
 #include "mc/mc.h"
 #include "src/mc/mc_replay.h"
+#include "src/surf/virtual_machine.hpp"
 #include "src/surf/host_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix,
 #include "src/surf/host_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix,
@@ -323,19 +324,12 @@ smx_synchro_t SIMIX_execution_parallel_start(const char *name,
   for (i = 0; i < host_nb; i++)
     host_list_cpy[i] = host_list[i];
 
   for (i = 0; i < host_nb; i++)
     host_list_cpy[i] = host_list[i];
 
-
-  /* FIXME: what happens if host_list contains VMs and PMs. If
-   * execute_parallel_task() does not change the state of the model, we can mix
-   * them. */
-  surf_host_model_t ws_model =
-    host_list[0]->extension<simgrid::surf::Host>()->getModel();
+  /* Check that we are not mixing VMs and PMs in the parallel task */
+  simgrid::surf::Host *host = host_list[0]->extension<simgrid::surf::Host>();
+  bool is_a_vm = (nullptr != dynamic_cast<simgrid::surf::VirtualMachine*>(host));
   for (i = 1; i < host_nb; i++) {
   for (i = 1; i < host_nb; i++) {
-    surf_host_model_t ws_model_tmp =
-      host_list[i]->extension<simgrid::surf::Host>()->getModel();
-    if (ws_model_tmp != ws_model) {
-      XBT_CRITICAL("mixing VMs and PMs is not supported");
-      DIE_IMPOSSIBLE;
-    }
+    bool tmp_is_a_vm = (nullptr != dynamic_cast<simgrid::surf::VirtualMachine*>(host_list[i]->extension<simgrid::surf::Host>()));
+    xbt_assert(is_a_vm == tmp_is_a_vm, "parallel_execute: mixing VMs and PMs is not supported (yet).");
   }
 
   /* set surf's synchro */
   }
 
   /* set surf's synchro */
index 33a2ffc..1476127 100644 (file)
@@ -26,7 +26,6 @@ class XBT_PRIVATE HostL07Model;
 class XBT_PRIVATE CpuL07Model;
 class XBT_PRIVATE NetworkL07Model;
 
 class XBT_PRIVATE CpuL07Model;
 class XBT_PRIVATE NetworkL07Model;
 
-class XBT_PRIVATE HostL07;
 class XBT_PRIVATE CpuL07;
 class XBT_PRIVATE LinkL07;
 
 class XBT_PRIVATE CpuL07;
 class XBT_PRIVATE LinkL07;
 
index a2a5dce..bd807ad 100644 (file)
@@ -260,9 +260,8 @@ xbt_dynar_t surf_host_get_vms(sg_host_t host){
   unsigned int cpt;
   simgrid::surf::VirtualMachine *vm;
   xbt_dynar_foreach(vms, cpt, vm) {
   unsigned int cpt;
   simgrid::surf::VirtualMachine *vm;
   xbt_dynar_foreach(vms, cpt, vm) {
-    // TODO, use a backlink from simgrid::surf::Host to simgrid::s4u::Host 
-    sg_host_t vm_ = (sg_host_t) xbt_dict_get_elm_or_null(host_list, vm->getName());
-    xbt_dynar_push(vms_, &vm_);
+    sg_host_t cpy_ = vm->getHost();
+    xbt_dynar_push(vms_, &cpy_);
   }
   xbt_dynar_free(&vms);
   return vms_;
   }
   xbt_dynar_free(&vms);
   return vms_;