-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
40 changed files
with
514 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
examples/basic-examples/bare-metal-data-movement/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
set(SOURCE_FILES | ||
DataMovementWMS.h | ||
DataMovementWMS.cpp | ||
DataMovement.cpp | ||
) | ||
|
||
add_executable(wrench-bare-metal-data-movement-simulator ${SOURCE_FILES}) | ||
|
||
target_link_libraries(wrench-bare-metal-data-movement-simulator wrench ${SimGrid_LIBRARY} ${PUGIXML_LIBRARY} ${LEMON_LIBRARY}) | ||
|
||
install(TARGETS wrench-bare-metal-data-movement-simulator DESTINATION bin) | ||
|
146 changes: 146 additions & 0 deletions
146
examples/basic-examples/bare-metal-data-movement/DataMovement.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
/** | ||
* Copyright (c) 2017-2018. The WRENCH Team. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
/** | ||
** This simulator simulates the execution of a one-task workflow, where the task is: | ||
** | ||
** {InFile #0, InFile #1} -> Task -> {OutFile #0, OutFile #1} | ||
** | ||
** The compute platform comprises four hosts, WMSHost, StorageHost1, StorageHost2, and ComputeHost. | ||
** On WMSHost runs a WMS (defined in class DataMovementWMS). On ComputeHost runs a bare metal | ||
** compute service, that has access to the 10 cores of that host. On StorageHost1 and | ||
** StorageHost2 run two storage services. Once the simulation is done, | ||
** the completion time of each workflow task is printed. | ||
** | ||
** Example invocation of the simulator with only WMS logging: | ||
** ./bare-metal-data-movement-simulator ./four_hosts.xml --wrench-no-logs --log=custom_wms.threshold=info | ||
** | ||
** Example invocation of the simulator for a 5-task workflow with full logging: | ||
** ./bare-metal-data-movement-simulator ./four_hosts.xml | ||
**/ | ||
|
||
|
||
#include <iostream> | ||
#include <wrench.h> | ||
|
||
#include "DataMovementWMS.h" // WMS implementation | ||
|
||
/** | ||
* @brief The Simulator's main function | ||
* | ||
* @param argc: argument count | ||
* @param argv: argument array | ||
* @return 0 on success, non-zero otherwise | ||
*/ | ||
int main(int argc, char **argv) { | ||
|
||
/* | ||
* Declare a WRENCH simulation object | ||
*/ | ||
wrench::Simulation simulation; | ||
|
||
/* Initialize the simulation, which may entail extracting WRENCH-specific and | ||
* Simgrid-specific command-line arguments that can modify general simulation behavior. | ||
* Two special command-line arguments are --help-wrench and --help-simgrid, which print | ||
* details about available command-line arguments. */ | ||
simulation.init(&argc, argv); | ||
|
||
/* Parsing of the command-line arguments for this WRENCH simulation */ | ||
if (argc != 2) { | ||
std::cerr << "Usage: " << argv[0] << " <xml platform file> [--wrench-no-logs --log=custom_wms.threshold=info]" << std::endl; | ||
exit(1); | ||
} | ||
|
||
/* Reading and parsing the platform description file, written in XML following the SimGrid-defined DTD, | ||
* to instantiate the simulated platform */ | ||
std::cerr << "Instantiating simulated platform..." << std::endl; | ||
simulation.instantiatePlatform(argv[1]); | ||
|
||
/* Declare a workflow */ | ||
wrench::Workflow workflow; | ||
|
||
/* Add the workflow task an files */ | ||
auto task = workflow.addTask("task", 10000000000.0, 1, 10, 0.90, 10000000); | ||
task->addInputFile(workflow.addFile("infile_1", 100000000)); | ||
task->addInputFile(workflow.addFile("infile_2", 10000000)); | ||
task->addOutputFile(workflow.addFile("outfile_1", 200000000)); | ||
task->addOutputFile(workflow.addFile("outfile_2", 5000000)); | ||
|
||
/* Instantiate a storage service, and add it to the simulation. | ||
* A wrench::StorageService is an abstraction of a service on | ||
* which files can be written and read. This particular storage service, which is an instance | ||
* of wrench::SimpleStorageService, is started on StorageHost1 in the | ||
* platform , which has an attached disk mounted at "/". The SimpleStorageService | ||
* is a basic storage service implementation provided by WRENCH. | ||
* Throughout the simulation execution, input/output files of workflow tasks will be located | ||
* in this storage service, and accessed remotely by the compute service. Note that the | ||
* storage service is configured to use a buffer size of 50M when transferring data over | ||
* the network (i.e., to pipeline disk reads/writes and network revs/sends). */ | ||
std::cerr << "Instantiating a SimpleStorageService on StorageHost1..." << std::endl; | ||
auto storage_service1 = simulation.add(new wrench::SimpleStorageService( | ||
"StorageHost1", {"/"}, {{wrench::SimpleStorageServiceProperty::BUFFER_SIZE, "50000000"}}, {})); | ||
|
||
/* Instantiate another one on StorageHost2 */ | ||
std::cerr << "Instantiating a SimpleStorageService on StorageHost2..." << std::endl; | ||
auto storage_service2 = simulation.add(new wrench::SimpleStorageService( | ||
"StorageHost2", {"/"}, {{wrench::SimpleStorageServiceProperty::BUFFER_SIZE, "50000000"}}, {})); | ||
|
||
/* Instantiate a bare-metal compute service, and add it to the simulation. | ||
* A wrench::BareMetalComputeService is an abstraction of a compute service that corresponds | ||
* to a software infrastructure that can execute tasks on hardware resources. | ||
* This particular service is started on ComputeHost and has no scratch storage space (mount point argument = ""). | ||
* This means that tasks running on this service will access data only from remote storage services. */ | ||
std::cerr << "Instantiating a BareMetalComputeService on ComputeHost..." << std::endl; | ||
auto baremetal_service = simulation.add(new wrench::BareMetalComputeService( | ||
"ComputeHost", {"ComputeHost"}, "", {}, {})); | ||
|
||
/* Instantiate a WMS, to be stated on WMSHost, which is responsible | ||
* for executing the workflow. */ | ||
|
||
auto wms = simulation.add( | ||
new wrench::DataMovementWMS({baremetal_service}, {storage_service1, storage_service2}, "WMSHost")); | ||
|
||
/* Associate the workflow to the WMS */ | ||
wms->addWorkflow(&workflow); | ||
|
||
/* Instantiate a file registry service to be started on WMSHost. This service is | ||
* essentially a replica catalog that stores <file , storage service> pairs so that | ||
* any service, in particular a WMS, can discover where workflow files are stored. */ | ||
std::cerr << "Instantiating a FileRegistryService on WMSHost ..." << std::endl; | ||
auto file_registry_service = new wrench::FileRegistryService("WMSHost"); | ||
simulation.add(file_registry_service); | ||
|
||
/* It is necessary to store, or "stage", input files that only input. The getInputFiles() | ||
* method of the Workflow class returns the set of all workflow files that are not generated | ||
* by workflow tasks, and thus are only input files. These files are then staged on the storage service. */ | ||
std::cerr << "Staging task input files..." << std::endl; | ||
for (auto const &f : workflow.getInputFiles()) { | ||
simulation.stageFile(f, storage_service1); | ||
} | ||
|
||
/* Launch the simulation. This call only returns when the simulation is complete. */ | ||
std::cerr << "Launching the Simulation..." << std::endl; | ||
try { | ||
simulation.launch(); | ||
} catch (std::runtime_error &e) { | ||
std::cerr << "Exception: " << e.what() << std::endl; | ||
return 1; | ||
} | ||
std::cerr << "Simulation done!" << std::endl; | ||
|
||
/* Simulation results can be examined via simulation.output, which provides access to traces | ||
* of events. In the code below, we print the retrieve the trace of all task completion events, print how | ||
* many such events there are, and print some information for the first such event. */ | ||
auto trace = simulation.getOutput().getTrace<wrench::SimulationTimestampTaskCompletion>(); | ||
for (auto const &item : trace) { | ||
std::cerr << "Task " << item->getContent()->getTask()->getID() << " completed at time " << item->getDate() << std::endl; | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.