From 14dbe48f4f9623cf72fc207b7c2041b9f611972a Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 9 Feb 2016 00:51:54 +0100 Subject: [PATCH 1/1] Introduce DTD v4 See ChangeLog --- ChangeLog | 21 ++++++- include/simgrid/forward.h | 2 +- include/surf/surfxml_parse.h | 8 +-- src/bindings/lua/lua_platf.cpp | 21 +++++-- src/include/surf/surf.h | 2 - src/smpi/smpirun.in | 22 +++---- src/surf/simgrid.dtd | 66 +++++++++++++++++--- src/surf/storage_n11.cpp | 9 ++- src/surf/surfxml_parse.cpp | 103 +++++++++++++++++-------------- src/surf/surfxml_parseplatf.cpp | 2 +- tools/cmake/MaintainerMode.cmake | 4 +- tools/simgrid_update_xml.pl | 69 ++++++++++++++++----- 12 files changed, 231 insertions(+), 98 deletions(-) diff --git a/ChangeLog b/ChangeLog index efa83e44d9..6b04d3f69b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,8 +13,27 @@ SimGrid (3.13) UNRELEASED; urgency=low - We removed support for writing your simulation in Lua; you can use the Java bindings. - + XML platforms: + * Switch to platform v4 format. + - Rename (power->speed) the attributes describing the amount of flop + that a , , or can deliver per second. + - In , attribute kind="POWER" is now kind="SPEED". + - The DOCTYPE points to the right URL (this file): + http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd + - A warning is emitted for unit-less values (they are still accepted). + - speed. Default: 'f' or 'flops'. Also defined: + 'Yf', 'Zf', 'Ef', 'Pf', 'Tf', 'Gf', 'Mf', 'kf' + 'yottaflops', 'zettaflops', 'exaflops', 'petaflops', 'teraflops', 'gigaflops', 'megaflops', 'kiloflops' + - bandwidth. Default: 'Bps' bytes per second (or 'bps' for bits but 1 Bps = 8 bps) + Also defined in bytes: 'TiBps', 'GiBps', 'MiBps', 'KiBps', 'TBps', 'GBps', 'MBps', 'kBps', 'Bps' + And the same in bits: 'Tibps', 'Gibps', 'Mibps', 'Kibps', 'Tbps', 'Gbps', 'Mbps', 'kbps', 'bps' + - latency. Default: 's' second. Also defined: + 'w' week, 'd' day, 'h' hour, 'm' minute, 'ms' millisecond, 'us' microsecond, 'ns' nanosecond, 'ps' picosecond + * Use the tool simgrid_update_xml to upgrade your files. It does not + convert the unit-less values. Use tools/sg_xml_unit_converter.py + for that (or live with the warnings). + S4U * s4u::Host is now the prefered public interface to the Host features. sg_host_* functions are C bindings to the exact same behavior diff --git a/include/simgrid/forward.h b/include/simgrid/forward.h index 19082b71ce..54210ac56e 100644 --- a/include/simgrid/forward.h +++ b/include/simgrid/forward.h @@ -65,7 +65,7 @@ typedef enum { typedef enum { SURF_TRACE_CONNECT_KIND_HOST_AVAIL = 4, - SURF_TRACE_CONNECT_KIND_POWER = 3, + SURF_TRACE_CONNECT_KIND_SPEED = 3, SURF_TRACE_CONNECT_KIND_LINK_AVAIL = 2, SURF_TRACE_CONNECT_KIND_BANDWIDTH = 1, SURF_TRACE_CONNECT_KIND_LATENCY = 0 diff --git a/include/surf/surfxml_parse.h b/include/surf/surfxml_parse.h index b270f5d2d0..83957d15fa 100644 --- a/include/surf/surfxml_parse.h +++ b/include/surf/surfxml_parse.h @@ -29,10 +29,10 @@ XBT_PUBLIC(void) XBT_ATTRIB_NORETURN surf_parse_error(const char *msg,...) XBT_A XBT_PUBLIC(void) surf_parse_warn(const char *msg,...) XBT_ATTRIB_PRINTF(1,2); XBT_PUBLIC(double) surf_parse_get_double(const char *string); XBT_PUBLIC(int) surf_parse_get_int(const char *string); -XBT_PUBLIC(double) surf_parse_get_time(const char *string); -XBT_PUBLIC(double) surf_parse_get_size(const char *string); -XBT_PUBLIC(double) surf_parse_get_bandwidth(const char *string); -XBT_PUBLIC(double) surf_parse_get_speed(const char *string); +XBT_PUBLIC(double) surf_parse_get_time(const char *string, const char *entity_kind, const char *name); +XBT_PUBLIC(double) surf_parse_get_size(const char *string, const char *entity_kind, const char *name); +XBT_PUBLIC(double) surf_parse_get_bandwidth(const char *string, const char *entity_kind, const char *name); +XBT_PUBLIC(double) surf_parse_get_speed(const char *string, const char *entity_kind, const char *name); /* Prototypes of the functions offered by flex */ XBT_PUBLIC(int) surf_parse_lex(void); diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index f5037bfc60..41c9a2cb4d 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -85,7 +85,7 @@ int console_add_backbone(lua_State *L) { if (type != LUA_TSTRING && type != LUA_TNUMBER) { XBT_ERROR("Attribute 'bandwidth' must be specified for backbone and must either be a string (in the right format; see docs) or a number."); } - link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1)); + link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1),"bandwidth of backbone",link.id); lua_pop(L, 1); lua_pushstring(L, "lat"); @@ -93,7 +93,7 @@ int console_add_backbone(lua_State *L) { if (type != LUA_TSTRING && type != LUA_TNUMBER) { XBT_ERROR("Attribute 'lat' must be specified for backbone and must either be a string (in the right format; see docs) or a number."); } - link.latency = surf_parse_get_time(lua_tostring(L, -1)); + link.latency = surf_parse_get_time(lua_tostring(L, -1),"latency of backbone",link.id); lua_pop(L, 1); link.initiallyOn = 1; @@ -172,7 +172,7 @@ int console_add_host(lua_State *L) { // get Id Value lua_pushstring(L, "id"); type = lua_gettable(L, -2); - if (type != LUA_TSTRING && type != LUA_TNUMBER) { + if (type != LUA_TSTRING) { XBT_ERROR("Attribute 'id' must be specified for any host and must be a string."); } host.id = lua_tostring(L, -1); @@ -185,7 +185,10 @@ int console_add_host(lua_State *L) { XBT_ERROR("Attribute 'speed' must be specified for host and must either be a string (in the correct format; check documentation) or a number."); } host.speed_peak = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push_as(host.speed_peak, double, parse_cpu_speed(lua_tostring(L, -1))); + if (type == LUA_TNUMBER) + xbt_dynar_push_as(host.speed_peak, double, lua_tointeger(L, -1)); + else // LUA_TSTRING + xbt_dynar_push_as(host.speed_peak, double, surf_parse_get_speed(lua_tostring(L, -1), "speed of host", host.id)); lua_pop(L, 1); // get core @@ -263,7 +266,10 @@ int console_add_link(lua_State *L) { if (type != LUA_TSTRING && type != LUA_TNUMBER) { XBT_ERROR("Attribute 'bandwidth' must be specified for any link and must either be either a string (in the right format; see docs) or a number."); } - link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1)); + if (type == LUA_TNUMBER) + link.bandwidth = lua_tonumber(L, -1); + else // LUA_TSTRING + link.bandwidth = surf_parse_get_bandwidth(lua_tostring(L, -1),"bandwidth of link", link.id); lua_pop(L, 1); //get latency value @@ -272,7 +278,10 @@ int console_add_link(lua_State *L) { if (type != LUA_TSTRING && type != LUA_TNUMBER) { XBT_ERROR("Attribute 'lat' must be specified for any link and must either be a string (in the right format; see docs) or a number."); } - link.latency = surf_parse_get_time(lua_tostring(L, -1)); + if (type == LUA_TNUMBER) + link.latency = lua_tonumber(L, -1); + else // LUA_TSTRING + link.latency = surf_parse_get_time(lua_tostring(L, -1),"latency of link", link.id); lua_pop(L, 1); /*Optional Arguments */ diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 2a5aeec9f5..0b98b0679c 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -976,8 +976,6 @@ XBT_PUBLIC(void) parse_platform_file(const char *file); /* For the trace and trace:connect tag (store their content till the end of the parsing) */ XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list; -XBT_PUBLIC(double) parse_cpu_speed(const char *str_speed); - XBT_PUBLIC(xbt_dict_t) get_as_router_properties(const char* name); /* diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index fb1754a32b..895ed69e74 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -11,18 +11,18 @@ SIMGRID_VERSION="@SIMGRID_VERSION_STRING@" SIMGRID_GITHASH="@SIMGRID_GITHASH@" -DEFAULT_LOOPBACK_BANDWIDTH="498000000" -DEFAULT_LOOPBACK_LATENCY="0.000004" -DEFAULT_NETWORK_BANDWIDTH="$((26 * 1024 * 1024))" -DEFAULT_NETWORK_LATENCY="0.000005" +DEFAULT_LOOPBACK_BANDWIDTH="498000000Bps" +DEFAULT_LOOPBACK_LATENCY="0.000004s" +DEFAULT_NETWORK_BANDWIDTH="$((26 * 1024 * 1024))Bps" +DEFAULT_NETWORK_LATENCY="0.000005s" DEFAULT_NUMPROCS="4" -DEFAULT_POWER="100" +DEFAULT_SPEED="100flops" LOOPBACK_BANDWIDTH="${DEFAULT_LOOPBACK_BANDWIDTH}" LOOPBACK_LATENCY="${DEFAULT_LOOPBACK_LATENCY}" NETWORK_BANDWIDTH="${DEFAULT_NETWORK_BANDWIDTH}" NETWORK_LATENCY="${DEFAULT_NETWORK_LATENCY}" -POWER="${DEFAULT_POWER}" +SPEED="${DEFAULT_SPEED}" SIMOPTS="--cfg=surf/precision:1e-9 --cfg=network/model:SMPI --cfg=network/TCP_gamma:4194304" @@ -347,14 +347,14 @@ if [ -z "${PLATFORM}" ]; then cat > ${PLATFORMTMP} < - - + + PLATFORMHEAD i=${NUMPROCS} while [ $i -gt 0 ]; do - echo " " >> ${PLATFORMTMP} + echo " " >> ${PLATFORMTMP} echo " " >> ${PLATFORMTMP} echo " " >> ${PLATFORMTMP} i=$((i - 1)) @@ -391,8 +391,8 @@ APPLICATIONTMP="$(mktemp smpitmp-appXXXXXX)" cat > ${APPLICATIONTMP} < - - + + APPLICATIONHEAD ##---- cache hostnames of hostfile--------------- diff --git a/src/surf/simgrid.dtd b/src/surf/simgrid.dtd index 70f5032ec7..fff5eb3db4 100644 --- a/src/surf/simgrid.dtd +++ b/src/surf/simgrid.dtd @@ -1,4 +1,54 @@ - + + @@ -21,7 +71,7 @@ - + @@ -46,7 +96,7 @@ - + @@ -75,7 +125,7 @@ - + @@ -83,7 +133,7 @@ - + @@ -97,13 +147,13 @@ - + - + @@ -124,7 +174,7 @@ - + diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 061023ed5c..6fc77aed93 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -91,9 +91,12 @@ Storage *StorageN11Model::createStorage(const char* id, const char* type_id, storage_type_t storage_type = (storage_type_t) xbt_lib_get_or_null(storage_type_lib, type_id,ROUTING_STORAGE_TYPE_LEVEL); - double Bread = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bread")); - double Bwrite = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bwrite")); - double Bconnection = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection")); + double Bread = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bread"), + "property Bread, storage",type_id); + double Bwrite = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bwrite"), + "property Bwrite, storage",type_id); + double Bconnection = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection"), + "property Bconnection, storage",type_id); Storage *storage = new StorageN11(this, id, properties, p_maxminSystem, Bread, Bwrite, Bconnection, type_id, (char *)content_name, diff --git a/src/surf/surfxml_parse.cpp b/src/surf/surfxml_parse.cpp index b440ea3bda..ddbb223db6 100644 --- a/src/surf/surfxml_parse.cpp +++ b/src/surf/surfxml_parse.cpp @@ -72,10 +72,11 @@ struct unit_scale { double scale; }; -/* Note: field `unit' for the last element of parametre `units' should be +/* Note: field `unit' for the last element of parameter `units' should be * NULL. */ -static double surf_parse_get_value_with_unit(const char *string, - const struct unit_scale *units) +static double surf_parse_get_value_with_unit(const char *string, const struct unit_scale *units, + const char *entity_kind, const char *name, + const char *error_msg, const char *default_unit) { char* ptr; double res; @@ -86,6 +87,13 @@ static double surf_parse_get_value_with_unit(const char *string, surf_parse_error("value out of range: %s", string); if (ptr == string) surf_parse_error("cannot parse number: %s", string); + if (ptr[0] == '\0') { + if (res == 0) + return res; // Ok, 0 can be unit-less + + XBT_WARN("Deprecated unit-less value '%s' for %s %s. %s",string, entity_kind, name, error_msg); + ptr = (char*)default_unit; + } for (i = 0; units[i].unit != NULL && strcmp(ptr, units[i].unit) != 0; i++) { } if (units[i].unit != NULL) @@ -95,7 +103,7 @@ static double surf_parse_get_value_with_unit(const char *string, return res; } -double surf_parse_get_time(const char *string) +double surf_parse_get_time(const char *string, const char *entity_kind, const char *name) { const struct unit_scale units[] = { { "w", 7 * 24 * 60 * 60 }, @@ -103,17 +111,17 @@ double surf_parse_get_time(const char *string) { "h", 60 * 60 }, { "m", 60 }, { "s", 1.0 }, - { "", 1.0 }, /* default unit is seconds */ { "ms", 1e-3 }, { "us", 1e-6 }, { "ns", 1e-9 }, { "ps", 1e-12 }, { NULL, 0 } }; - return surf_parse_get_value_with_unit(string, units); + return surf_parse_get_value_with_unit(string, units, entity_kind, name, + "Append 's' to your time to get seconds", "s"); } -double surf_parse_get_size(const char *string) +double surf_parse_get_size(const char *string, const char *entity_kind, const char *name) { const struct unit_scale units[] = { { "TiB", pow(1024, 4) }, @@ -125,7 +133,6 @@ double surf_parse_get_size(const char *string) { "MB", 1e6 }, { "kB", 1e3 }, { "B", 1.0 }, - { "", 1.0 }, /* default unit is bytes*/ { "Tib", 0.125 * pow(1024, 4) }, { "Gib", 0.125 * pow(1024, 3) }, { "Mib", 0.125 * pow(1024, 2) }, @@ -137,10 +144,11 @@ double surf_parse_get_size(const char *string) { "b", 0.125 }, { NULL, 0 } }; - return surf_parse_get_value_with_unit(string, units); + return surf_parse_get_value_with_unit(string, units, entity_kind, name, + "Append 'B' to get bytes (or 'b' for bits but 1B = 8b).", "B"); } -double surf_parse_get_bandwidth(const char *string) +double surf_parse_get_bandwidth(const char *string, const char *entity_kind, const char *name) { const struct unit_scale units[] = { { "TiBps", pow(1024, 4) }, @@ -152,7 +160,6 @@ double surf_parse_get_bandwidth(const char *string) { "MBps", 1e6 }, { "kBps", 1e3 }, { "Bps", 1.0 }, - { "", 1.0 }, /* default unit is bytes per second */ { "Tibps", 0.125 * pow(1024, 4) }, { "Gibps", 0.125 * pow(1024, 3) }, { "Mibps", 0.125 * pow(1024, 2) }, @@ -164,10 +171,11 @@ double surf_parse_get_bandwidth(const char *string) { "bps", 0.125 }, { NULL, 0 } }; - return surf_parse_get_value_with_unit(string, units); + return surf_parse_get_value_with_unit(string, units, entity_kind, name, + "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps"); } -double surf_parse_get_speed(const char *string) +double surf_parse_get_speed(const char *string, const char *entity_kind, const char *name) { const struct unit_scale units[] = { { "yottaflops", 1e24 }, @@ -188,10 +196,10 @@ double surf_parse_get_speed(const char *string) { "kf", 1e3 }, { "flops", 1.0 }, { "f", 1.0 }, - { "", 1.0 }, /* default unit is flops */ { NULL, 0 } }; - return surf_parse_get_value_with_unit(string, units); + return surf_parse_get_value_with_unit(string, units, entity_kind, name, + "Append 'f' or 'flops' to your speed to get flop per second", "f"); } /* @@ -258,7 +266,8 @@ void ETag_surfxml_storage___type(void) storage_type.model = A_surfxml_storage___type_model; storage_type.properties = current_property_set; storage_type.model_properties = current_model_property_set; - storage_type.size = surf_parse_get_size(A_surfxml_storage___type_size); + storage_type.size = surf_parse_get_size(A_surfxml_storage___type_size, + "size of storage type", storage_type.id); sg_platf_new_storage_type(&storage_type); current_property_set = NULL; current_model_property_set = NULL; @@ -394,6 +403,16 @@ void STag_surfxml_platform(void) { "Use simgrid_update_xml to update your file automatically. " "This program is installed automatically with SimGrid, or " "available in the tools/ directory of the source archive."); + xbt_assert((version >= 4.0), "******* FILE %s IS TOO OLD (v:%.1f) *********\n " + "Changes introduced in SimGrid 3.13:\n" + " - 'power' attribute of hosts (and others) got renamed to 'speed'.\n" + " - In , attribute kind=\"POWER\" is now kind=\"SPEED\".\n" + " - DOCTYPE now point to the rignt URL: http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd\n" + " - speed, bandwidth and latency attributes now MUST have an explicit unit (f, Bps, s by default)" + "\n\n" + "Use simgrid_update_xml to update your file automatically. " + "This program is installed automatically with SimGrid, or " + "available in the tools/ directory of the source archive.",surf_parsed_filename, version); sg_platf_begin(); } @@ -438,11 +457,11 @@ void ETag_surfxml_host(void) { host.id = A_surfxml_host_id; - buf = A_surfxml_host_power; + buf = A_surfxml_host_speed; XBT_DEBUG("Buffer: %s", buf); host.speed_peak = xbt_dynar_new(sizeof(double), NULL); if (strchr(buf, ',') == NULL){ - double speed = parse_cpu_speed(A_surfxml_host_power); + double speed = surf_parse_get_speed(A_surfxml_host_speed,"speed of host", host.id); xbt_dynar_push_as(host.speed_peak,double, speed); } else { @@ -454,7 +473,7 @@ void ETag_surfxml_host(void) { xbt_dynar_get_cpy(pstate_list, i, &speed_str); xbt_str_trim(speed_str, NULL); - speed = parse_cpu_speed(speed_str); + speed = surf_parse_get_speed(speed_str,"speed of host", host.id); xbt_dynar_push_as(host.speed_peak, double, speed); XBT_DEBUG("Speed value: %f", speed); } @@ -511,20 +530,20 @@ void ETag_surfxml_cluster(void){ cluster.prefix = A_surfxml_cluster_prefix; cluster.suffix = A_surfxml_cluster_suffix; cluster.radical = A_surfxml_cluster_radical; - cluster.speed = surf_parse_get_speed(A_surfxml_cluster_power); + cluster.speed = surf_parse_get_speed(A_surfxml_cluster_speed, "speed of cluster", cluster.id); cluster.core_amount = surf_parse_get_int(A_surfxml_cluster_core); - cluster.bw = surf_parse_get_bandwidth(A_surfxml_cluster_bw); - cluster.lat = surf_parse_get_time(A_surfxml_cluster_lat); + cluster.bw = surf_parse_get_bandwidth(A_surfxml_cluster_bw, "bw of cluster", cluster.id); + cluster.lat = surf_parse_get_time(A_surfxml_cluster_lat, "lat of cluster", cluster.id); if(strcmp(A_surfxml_cluster_bb___bw,"")) - cluster.bb_bw = surf_parse_get_bandwidth(A_surfxml_cluster_bb___bw); + cluster.bb_bw = surf_parse_get_bandwidth(A_surfxml_cluster_bb___bw, "bb_bw of cluster", cluster.id); if(strcmp(A_surfxml_cluster_bb___lat,"")) - cluster.bb_lat = surf_parse_get_time(A_surfxml_cluster_bb___lat); + cluster.bb_lat = surf_parse_get_time(A_surfxml_cluster_bb___lat, "bb_lat of cluster", cluster.id); if(strcmp(A_surfxml_cluster_limiter___link,"")) cluster.limiter_link = surf_parse_get_double(A_surfxml_cluster_limiter___link); if(strcmp(A_surfxml_cluster_loopback___bw,"")) - cluster.loopback_bw = surf_parse_get_bandwidth(A_surfxml_cluster_loopback___bw); + cluster.loopback_bw = surf_parse_get_bandwidth(A_surfxml_cluster_loopback___bw, "loopback_bw of cluster", cluster.id); if(strcmp(A_surfxml_cluster_loopback___lat,"")) - cluster.loopback_lat = surf_parse_get_time(A_surfxml_cluster_loopback___lat); + cluster.loopback_lat = surf_parse_get_time(A_surfxml_cluster_loopback___lat, "loopback_lat of cluster", cluster.id); switch(AX_surfxml_cluster_topology){ case A_surfxml_cluster_topology_FLAT: @@ -591,9 +610,9 @@ void STag_surfxml_cabinet(void){ cabinet.id = A_surfxml_cabinet_id; cabinet.prefix = A_surfxml_cabinet_prefix; cabinet.suffix = A_surfxml_cabinet_suffix; - cabinet.speed = surf_parse_get_speed(A_surfxml_cabinet_power); - cabinet.bw = surf_parse_get_bandwidth(A_surfxml_cabinet_bw); - cabinet.lat = surf_parse_get_time(A_surfxml_cabinet_lat); + cabinet.speed = surf_parse_get_speed(A_surfxml_cabinet_speed, "speed of cabinet", cabinet.id); + cabinet.bw = surf_parse_get_bandwidth(A_surfxml_cabinet_bw, "bw of cabinet", cabinet.id); + cabinet.lat = surf_parse_get_time(A_surfxml_cabinet_lat, "lat of cabinet", cabinet.id); cabinet.radical = A_surfxml_cabinet_radical; sg_platf_new_cabinet(&cabinet); @@ -604,10 +623,10 @@ void STag_surfxml_peer(void){ s_sg_platf_peer_cbarg_t peer = SG_PLATF_PEER_INITIALIZER; memset(&peer,0,sizeof(peer)); peer.id = A_surfxml_peer_id; - peer.speed = surf_parse_get_speed(A_surfxml_peer_power); - peer.bw_in = surf_parse_get_bandwidth(A_surfxml_peer_bw___in); - peer.bw_out = surf_parse_get_bandwidth(A_surfxml_peer_bw___out); - peer.lat = surf_parse_get_time(A_surfxml_peer_lat); + peer.speed = surf_parse_get_speed(A_surfxml_peer_speed, "speed of peer", peer.id); + peer.bw_in = surf_parse_get_bandwidth(A_surfxml_peer_bw___in, "bw_in of peer", peer.id); + peer.bw_out = surf_parse_get_bandwidth(A_surfxml_peer_bw___out, "bw_out of peer", peer.id); + peer.lat = surf_parse_get_time(A_surfxml_peer_lat, "lat of peer", peer.id); peer.coord = A_surfxml_peer_coordinates; peer.availability_trace = tmgr_trace_new_from_file(A_surfxml_peer_availability___file); peer.state_trace = tmgr_trace_new_from_file(A_surfxml_peer_state___file); @@ -627,10 +646,10 @@ void ETag_surfxml_link(void){ link.properties = current_property_set; link.id = A_surfxml_link_id; - link.bandwidth = surf_parse_get_bandwidth(A_surfxml_link_bandwidth); + link.bandwidth = surf_parse_get_bandwidth(A_surfxml_link_bandwidth, "bandwidth of link", link.id); //printf("Link bandwidth [%g]\n", link.bandwidth); link.bandwidth_trace = tmgr_trace_new_from_file(A_surfxml_link_bandwidth___file); - link.latency = surf_parse_get_time(A_surfxml_link_latency); + link.latency = surf_parse_get_time(A_surfxml_link_latency, "latency of link", link.id); //printf("Link latency [%g]\n", link.latency); link.latency_trace = tmgr_trace_new_from_file(A_surfxml_link_latency___file); @@ -695,8 +714,8 @@ void ETag_surfxml_backbone(void){ link.properties = NULL; link.id = A_surfxml_backbone_id; - link.bandwidth = surf_parse_get_bandwidth(A_surfxml_backbone_bandwidth); - link.latency = surf_parse_get_time(A_surfxml_backbone_latency); + link.bandwidth = surf_parse_get_bandwidth(A_surfxml_backbone_bandwidth, "bandwidth of backbone", link.id); + link.latency = surf_parse_get_time(A_surfxml_backbone_latency, "latency of backbone", link.id); link.initiallyOn = 1; link.policy = SURF_LINK_SHARED; @@ -851,8 +870,8 @@ void STag_surfxml_trace___connect(void){ switch (A_surfxml_trace___connect_kind) { case AU_surfxml_trace___connect_kind: - case A_surfxml_trace___connect_kind_POWER: - trace_connect.kind = SURF_TRACE_CONNECT_KIND_POWER; + case A_surfxml_trace___connect_kind_SPEED: + trace_connect.kind = SURF_TRACE_CONNECT_KIND_SPEED; break; case A_surfxml_trace___connect_kind_BANDWIDTH: trace_connect.kind = SURF_TRACE_CONNECT_KIND_BANDWIDTH; @@ -1059,12 +1078,6 @@ int_f_void_t surf_parse = _surf_parse; /** * With XML parser */ - -double parse_cpu_speed(const char *str_speed) -{ // FIXME deadcode - return surf_parse_get_speed(str_speed); -} - xbt_dict_t get_as_router_properties(const char* name) { return (xbt_dict_t)xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL); diff --git a/src/surf/surfxml_parseplatf.cpp b/src/surf/surfxml_parseplatf.cpp index ead4804893..eaa30d65ac 100644 --- a/src/surf/surfxml_parseplatf.cpp +++ b/src/surf/surfxml_parseplatf.cpp @@ -83,7 +83,7 @@ void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect) trace_connect->trace, xbt_strdup(trace_connect->element), NULL); break; - case SURF_TRACE_CONNECT_KIND_POWER: + case SURF_TRACE_CONNECT_KIND_SPEED: xbt_dict_set(trace_connect_list_host_speed, trace_connect->trace, xbt_strdup(trace_connect->element), NULL); break; diff --git a/tools/cmake/MaintainerMode.cmake b/tools/cmake/MaintainerMode.cmake index 836032f80e..712696cb71 100644 --- a/tools/cmake/MaintainerMode.cmake +++ b/tools/cmake/MaintainerMode.cmake @@ -156,7 +156,7 @@ if(enable_maintainer_mode AND NOT WIN32) ${CMAKE_HOME_DIRECTORY}/src/simdag/dax.dtd #${CMAKE_HOME_DIRECTORY}/src/surf/simgrid_dtd.l: ${CMAKE_HOME_DIRECTORY}/src/surf/simgrid.dtd - COMMAND ${FLEXML_EXE} --root-tags platform -b 1000000 -P surfxml --sysid=http://simgrid.gforge.inria.fr/simgrid.dtd -S src/surf/simgrid_dtd.l -L src/surf/simgrid.dtd + COMMAND ${FLEXML_EXE} --root-tags platform -b 1000000 -P surfxml --sysid=http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd -S src/surf/simgrid_dtd.l -L src/surf/simgrid.dtd COMMAND ${SED_EXE} -i ${string14} src/surf/simgrid_dtd.l COMMAND ${CMAKE_COMMAND} -E echo "src/surf/simgrid_dtd.l" @@ -173,7 +173,7 @@ if(enable_maintainer_mode AND NOT WIN32) #${CMAKE_HOME_DIRECTORY}/include/surf/simgrid_dtd.h: ${CMAKE_HOME_DIRECTORY}/src/surf/simgrid.dtd COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_HOME_DIRECTORY}/include/surf/simgrid.h - COMMAND ${FLEXML_EXE} --root-tags platform -P surfxml --sysid=http://simgrid.gforge.inria.fr/simgrid.dtd -H include/surf/simgrid_dtd.h -L src/surf/simgrid.dtd + COMMAND ${FLEXML_EXE} --root-tags platform -P surfxml --sysid=http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd -H include/surf/simgrid_dtd.h -L src/surf/simgrid.dtd COMMAND ${SED_EXE} -i ${string1} include/surf/simgrid_dtd.h COMMAND ${SED_EXE} -i ${string2} include/surf/simgrid_dtd.h COMMAND ${SED_EXE} -i ${string14} include/surf/simgrid_dtd.h diff --git a/tools/simgrid_update_xml.pl b/tools/simgrid_update_xml.pl index 7ec98798be..da3df3f190 100755 --- a/tools/simgrid_update_xml.pl +++ b/tools/simgrid_update_xml.pl @@ -28,7 +28,7 @@ is modified in place, without any kind of backup. You may want to save a copy before running the script. In SimGrid XML files, the standard version is indicated in the version -attribute of the platform tag. Current version is 3. Here is a list of major +attribute of the platform tag. Current version is 4. Here is a list of major changes in each version. =over 4 @@ -65,7 +65,7 @@ Several tags were renamed: =back -=item B Introduced in SimGrid 3.5 (this is the current version) +=item B Introduced in SimGrid 3.5 =over 4 @@ -87,6 +87,42 @@ Several tags were renamed (for sake of XML sanity): =back +=item B Introduced in SimGrid 3.13 (this is the current version) + +=over 4 + +=item + +Rename the attributes describing the amount of flop that a host / peer / cluster / cabinet can deliver per second. + + -> + +=item + +In , attribute kind="POWER" is now kind="SPEED". + +=item + +The DOCTYPE points to the right URL: http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd + +=item + +Units are now mandatory in attributes. USE THE SCRIPT sg_xml_unit_converter.py TO CONVERT THIS + + - speed. Old default: 'f' or 'flops'. Also defined: + 'Yf', 'Zf', 'Ef', 'Pf', 'Tf', 'Gf', 'Mf', 'kf' + 'yottaflops', 'zettaflops', 'exaflops', 'petaflops', 'teraflops', 'gigaflops', 'megaflops', 'kiloflops' + + - bandwidth. Old default: 'Bps' bytes per second (or 'bps' but 1 Bps = 8 bps) + Also defined in bytes: 'TiBps', 'GiBps', 'MiBps', 'KiBps', 'TBps', 'GBps', 'MBps', 'kBps', 'Bps' + And the same in bits: 'Tibps', 'Gibps', 'Mibps', 'Kibps', 'Tbps', 'Gbps', 'Mbps', 'kbps', 'bps' + + - latency. Old default: 's' second. Also defined: + 'w' week, 'd' day, 'h' hour, 'm' minute, 'ms' millisecond, 'us' microsecond, 'ns' nanosecond, 'ps' picosecond + + +=back + =back =head1 AUTHORS @@ -95,7 +131,7 @@ Several tags were renamed (for sake of XML sanity): =head1 COPYRIGHT AND LICENSE -Copyright (c) 2006-2014. The SimGrid Team. All rights reserved. +Copyright (c) 2006-2016. The SimGrid Team. All rights reserved. This program is free software; you may redistribute it and/or modify it under the terms of GNU LGPL (v2.1) license. @@ -106,15 +142,15 @@ under the terms of GNU LGPL (v2.1) license. use strict; my $fromversion=-1; -my $toversion=3; +my $toversion=4; my($output_string); -$ARGV[0] or die "simgrid_update_xml.pl \n"; -open INPUT, "$ARGV[0]" or die "Cannot open input file $ARGV[0]: $!\n"; +my $filename = $ARGV[0] or die "simgrid_update_xml.pl \n"; +open INPUT, "$filename" or die "Cannot open input file $filename: $!\n"; $output_string = "\n". - "\n". + "\n". "\n"; @@ -129,18 +165,18 @@ while (defined($line = )) { if ($line =~ s///) { $fromversion = 0; - print "version 0\n"; + print "$filename was using version 0\n"; next if !$line =~ /\S/; } elsif ($line =~ s///) { $fromversion = $1; - print "version $fromversion\n"; if ($fromversion == $toversion) { - die "Input platform file version is already $fromversion. This should be a no-op.\n"; + die "Input platform file $filename is already conformant to version $fromversion. This should be a no-op.\n"; } if ($fromversion > $toversion) { - die "Input platform file version is more recent than this script (file version: $fromversion; script version: $toversion)\n"; + die "Input platform file $filename is more recent than this script (file version: $fromversion; script version: $toversion)\n"; } next if !$line =~ /\S/; + print "$filename was using version $fromversion\n"; } if ($fromversion == 0) { @@ -185,18 +221,23 @@ while (defined($line = )) { $output_string .= " \n"; $AS_opened=1; } - } if($line=~/ $ARGV[0]"; +open OUTPUT, "> $filename"; print OUTPUT $output_string; close OUTPUT; -- 2.20.1