Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
protect against multiply create hosts in one location only
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 28 Nov 2015 20:44:20 +0000 (21:44 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 28 Nov 2015 20:44:20 +0000 (21:44 +0100)
src/surf/cpu_cas01.cpp
src/surf/cpu_ti.cpp
src/surf/host_ptask_L07.cpp
src/surf/sg_platf.cpp

index 8644a7b..a8412b0 100644 (file)
@@ -105,9 +105,6 @@ Cpu *CpuCas01Model::createCpu(const char *name, xbt_dynar_t power_peak,
 {
   Cpu *cpu = NULL;
   sg_host_t host = sg_host_by_name(name);
-  xbt_assert(!sg_host_surfcpu(host),
-             "Host '%s' declared several times in the platform file",
-             name);
   xbt_assert(xbt_dynar_getfirst_as(power_peak, double) > 0.0,
       "Power has to be >0.0. Did you forget to specify the mandatory power attribute?");
   xbt_assert(core > 0, "Invalid number of cores %d. Must be larger than 0", core);
index 87aac97..b2242fa 100644 (file)
@@ -434,9 +434,6 @@ Cpu *CpuTiModel::createCpu(const char *name,
 {
   xbt_assert(core==1,"Multi-core not handled with this model yet");
   sg_host_t host = sg_host_by_name(name);
-  xbt_assert(!sg_host_surfcpu(host),
-              "Host '%s' declared several times in the platform file",
-              name);
   xbt_assert(xbt_dynar_getfirst_as(powerPeak, double) > 0.0,
       "Power has to be >0.0. Did you forget to specify the mandatory power attribute?");
   CpuTi *cpu = new CpuTi(this, name, powerPeak, pstate, powerScale, powerTrace,
index fafc8f3..717e89a 100644 (file)
@@ -265,14 +265,7 @@ Action *HostL07Model::executeParallelTask(int host_nb,
 
 Host *HostL07Model::createHost(const char *name,RoutingEdge *netElm, Cpu *cpu)
 {
-  HostL07 *host = NULL;
-  sg_host_t sg_host = sg_host_by_name(name);
-
-  xbt_assert(!surf_host_resource_priv(sg_host),
-              "Host '%s' declared several times in the platform file.",
-              name);
-
-  host = new HostL07(this, name, NULL, netElm, cpu);
+  HostL07 *host = new HostL07(this, name, NULL, netElm, cpu);
 
   surf_callback_emit(hostCreatedCallbacks, host);
   xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, host);
@@ -316,10 +309,6 @@ Cpu *CpuL07Model::createCpu(const char *name,  xbt_dynar_t powerPeak,
   double power_initial = xbt_dynar_get_as(powerPeak, pstate, double);
   sg_host_t sg_host = sg_host_by_name(name);
 
-  xbt_assert(!surf_host_resource_priv(sg_host),
-              "Host '%s' declared several times in the platform file.",
-              name);
-
   CpuL07 *cpu = new CpuL07(this, name, cpu_properties,
                                     power_initial, power_scale, power_trace,
                          core, state_initial, state_trace);
index 820a60e..8e483c7 100644 (file)
@@ -137,6 +137,10 @@ void sg_platf_exit(void) {
 
 void sg_platf_new_host(sg_platf_host_cbarg_t host)
 {
+
+  xbt_assert(! sg_host_by_name(host->id),
+                    "Refusing to create a second host named '%s'.", host->id);
+
   RoutingEdge *net = NULL;
   As* current_routing = routing_get_current();
   if (current_routing)