Skip to content

Commit

Permalink
Modified the "load workflow from file" functions (DAX and JSON) so that
Browse files Browse the repository at this point in the history
they take as input a "reference speed" specification (e.g., "100Gf",
"1f", "4500 Mf"). This way, the task execution times in the DAX/JSON
are transformed into "flops".   The speeds specified in the XML platform
files are then used to scale execution times.  So, if the XML file says
"speed=10Mf"  and a "5Mf" reference speed is passed to loadFromDAX/JSON, then a task that
is specified in the workflow file as taking 100 seconds, will be running
on 50 seconds in the simualtion (because the simulation host is twice as
fast as the reference host)
  • Loading branch information
henricasanova committed Apr 13, 2018
1 parent d9c9bc2 commit ca53e07
Show file tree
Hide file tree
Showing 13 changed files with 248 additions and 194 deletions.
10 changes: 5 additions & 5 deletions examples/batch_hosts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
<platform version="4.1">
<zone id="AS0" routing="Full">
<host id="Host1" speed="1f" core="10"/>
<host id="Host2" speed="1f" core="10"/>
<host id="Host3" speed="1f" core="10"/>
<host id="Host4" speed="1f" core="10"/>
<host id="Host1" speed="1000Gf" core="10"/>
<host id="Host2" speed="1000Gf" core="10"/>
<host id="Host3" speed="1000Gf" core="10"/>
<host id="Host4" speed="1000Gf" core="10"/>
<link id="1" bandwidth="5000GBps" latency="0us"/>
<route src="Host1" dst="Host2">
<link_ctn id="1"/>
Expand All @@ -26,4 +26,4 @@
<link_ctn id="1"/>
</route>
</zone>
</platform>
</platform>
6 changes: 3 additions & 3 deletions examples/cloud_hosts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
<platform version="4.1">
<zone id="AS0" routing="Full">
<host id="Tremblay" speed="1f" core="1"/>
<host id="Jupiter" speed="1f" core="4"/>
<host id="Fafard" speed="1f" core="1"/>
<host id="Tremblay" speed="1000Gf" core="1"/>
<host id="Jupiter" speed="1000Gf" core="4"/>
<host id="Fafard" speed="1000Gf" core="1"/>

<link id="1" bandwidth="125MBps" latency="100us"/>

Expand Down
2 changes: 1 addition & 1 deletion examples/cluster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<zone id="AS0" routing="Full">

<cluster id="my_cluster" prefix="c-" suffix=".me" radical="0-9"
speed="3f" bw="125MBps" lat="100us" core="1"
speed="3000Gf" bw="125MBps" lat="100us" core="1"
bb_bw="125MBps" bb_lat="100us"/>
</zone>
</platform>
2 changes: 1 addition & 1 deletion examples/simple-wms/SimpleWMSBatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(int argc, char **argv) {
/* Reading and parsing the workflow description file to create a wrench::Workflow object */
std::cerr << "Loading workflow..." << std::endl;
wrench::Workflow workflow;
workflow.loadFromDAX(workflow_file);
workflow.loadFromDAX(workflow_file, "1000Gf");
std::cerr << "The workflow has " << workflow.getNumberOfTasks() << " tasks " << std::endl;
std::cerr.flush();

Expand Down
4 changes: 2 additions & 2 deletions examples/simple-wms/SimpleWMSCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int main(int argc, char **argv) {
/* Reading and parsing the workflow description file to create a wrench::Workflow object */
std::cerr << "Loading workflow..." << std::endl;
wrench::Workflow workflow;
workflow.loadFromDAX(workflow_file);
workflow.loadFromDAX(workflow_file, "1000Gf");
std::cerr << "The workflow has " << workflow.getNumberOfTasks() << " tasks " << std::endl;
std::cerr.flush();

Expand Down Expand Up @@ -144,7 +144,7 @@ int main(int argc, char **argv) {
wrench::NetworkProximityService *NPS = new wrench::NetworkProximityService(hostname_copy, hostname_list_copy, {
{wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_SERVICE_TYPE, "alltoall"},
{wrench::NetworkProximityServiceProperty::NETWORK_DAEMON_COMMUNICATION_COVERAGE, "1.0"},
{wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD, "10"},
{wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD, "600"},
{wrench::NetworkProximityServiceProperty::NETWORK_PROXIMITY_MEASUREMENT_PERIOD_MAX_NOISE, "10"}});

simulation.add(NPS);
Expand Down
4 changes: 2 additions & 2 deletions examples/two_hosts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
<platform version="4.1">
<zone id="AS0" routing="Full">
<host id="Tremblay" speed="1f"/>
<host id="Jupiter" speed="1f" core="1"/>
<host id="Tremblay" speed="1000Gf"/>
<host id="Jupiter" speed="1000Gf" core="1"/>

<link id="1" bandwidth="125MBps" latency="100us"/>

Expand Down
4 changes: 2 additions & 2 deletions examples/two_hosts_faulty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
<platform version="4.1">
<zone id="AS0" routing="Full">
<host id="Tremblay" speed="1f"/>
<host id="Jupiter" speed="1f" core="1"/>
<host id="Tremblay" speed="1000Gf"/>
<host id="Jupiter" speed="1000Gf" core="1"/>

<link id="1" bandwidth="125MBps" latency="100us"/>

Expand Down
2 changes: 2 additions & 0 deletions include/wrench/util/UnitParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef WRENCH_UNITPARSER_H
#define WRENCH_UNITPARSER_H

#include <unordered_map>

namespace wrench {

Expand Down Expand Up @@ -42,6 +43,7 @@ namespace wrench {

public:
static double parse_size(std::string string);
static double parse_compute_speed(std::string string);


};
Expand Down
4 changes: 2 additions & 2 deletions include/wrench/workflow/Workflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ namespace wrench {

void addControlDependency(WorkflowTask *, WorkflowTask *);

void loadFromDAX(const std::string &filename);
void loadFromDAX(const std::string &filename, const std::string &reference_flop_rate);

void loadFromJSON(const std::string &filename);
void loadFromJSON(const std::string &filename, const std::string &reference_flop_rate);

unsigned long getNumberOfTasks();

Expand Down
2 changes: 1 addition & 1 deletion src/wrench/simgrid_S4U_util/S4U_Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ namespace wrench {
}
try {
capacity_value = UnitParser::parse_size(capacity_string);
} catch (std::runtime_error &e) {
} catch (std::invalid_argument &e) {
throw std::invalid_argument(
"S4U_Simulation::getHostMemoryCapacity(): Host '" + std::string(host->getCname()) + "'has invalid memory capacity specification '" + tag +":" +
std::string(capacity_string) + "'");
Expand Down
22 changes: 21 additions & 1 deletion src/wrench/util/UnitParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ namespace wrench {
* @brief Given a string size specification with units (e.g., "13Mb") return the size in bytes
* @param string: the size specification
* @return the size in bytes
*
* @throws std::invalid_argument
*/
double UnitParser::parse_size(std::string string) {
static const UnitParser::unit_scale units{std::make_tuple("b", 0.125, 2, true), std::make_tuple("b", 0.125, 10, true),
Expand All @@ -97,12 +99,30 @@ namespace wrench {
try {
size = parseValueWithUnit(string, units, "B"); // default: bytes
} catch (std::runtime_error &e) {
throw;
throw std::invalid_argument(e.what());
}
return size;
}


/**
* @brief Given a string compute speed specification with units (e.g., "3f", "10Gf") return the size in bytes
* @param string: the size specification
* @return the size in bytes
*
* @throws std::invalid_argument
*/
double UnitParser::parse_compute_speed(std::string string) {
static const UnitParser::unit_scale units{std::make_tuple("f", 1.0, 10, true)};
double compute_speed;
try {
compute_speed = parseValueWithUnit(string, units, "f"); // default: bytes
} catch (std::runtime_error &e) {
throw std::invalid_argument(e.what());
}
return compute_speed;
}



};

0 comments on commit ca53e07

Please sign in to comment.