From: Martin Quinson Date: Sat, 28 Nov 2015 20:44:20 +0000 (+0100) Subject: protect against multiply create hosts in one location only X-Git-Tag: v3_13~1531 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/cbc3dbed9e2211bf4e014f52be067c99cfc0ea06 protect against multiply create hosts in one location only --- diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 8644a7b0a5..a8412b0975 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -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); diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 87aac97240..b2242fac7d 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -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, diff --git a/src/surf/host_ptask_L07.cpp b/src/surf/host_ptask_L07.cpp index fafc8f3dbb..717e89a12d 100644 --- a/src/surf/host_ptask_L07.cpp +++ b/src/surf/host_ptask_L07.cpp @@ -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); diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 820a60e2d1..8e483c7b85 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -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)