Skip to content

Commit

Permalink
Updated examples
Browse files Browse the repository at this point in the history
Updated wrench-init
  • Loading branch information
henricasanova committed Oct 9, 2024
1 parent 246cc9f commit f2945ad
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 19 deletions.
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ if (DEFINED SimGrid_PATH)
endif()
endif()
find_package(SimGrid REQUIRED)

# Find SimGrid's FS module
if (DEFINED FSMOD_PATH)
if (NOT EXISTS "${FSMOD_PATH}")
message(FATAL_ERROR "The specified FSMOD_PATH doesn't exit")
else()
file(GLOB LIBFSMOD_FILES
"${FSMOD_PATH}/liblibfsmod.so"
"${FSMOD_PATH}/lib/libfsmod.dylib"
)
if (NOT LIBFSMOD_FILES)
message(FATAL_ERROR "The specified FSMOD_PATH doesn't seem to contain a valid FSMod installation")
else()
set(CMAKE_PREFIX_PATH ${FSMOD_PATH} ${CMAKE_PREFIX_PATH})
endif()
endif()
endif()
find_package(FSMod REQUIRED)

# Find nlohmann_json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ int main(int argc, char **argv) {
* 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_service);
storage_service->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ int main(int argc, char **argv) {
* 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_service);
storage_service->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int main(int argc, char **argv) {
* 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_service);
storage_service->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ int main(int argc, char **argv) {
* 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);
storage_service1->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ int main(int argc, char **argv) {
* 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);
storage_service1->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ int main(int argc, char **argv) {
* 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_service);
storage_service->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int main(int argc, char **argv) {
* 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_service);
storage_service->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int main(int argc, char **argv) {
* 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_service);
storage_service->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ int main(int argc, char **argv) {
* 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_service);
storage_service->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ int main(int argc, char **argv) {

std::cerr << "Staging task input files..." << std::endl;
for (auto const &f: workflow->getInputFiles()) {
simulation->stageFile(f, storage_service);
storage_service->createFile(f);
}

double start = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ int main(int argc, char **argv) {

std::cerr << "Staging task input files..." << std::endl;
for (auto const &f: workflow->getInputFiles()) {
simulation->stageFile(f, server_storage_service);
server_storage_service->createFile(f);
}

simulation->getOutput().enableWorkflowTaskTimestamps(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int main(int argc, char **argv) {

std::cerr << "Staging task input files..." << std::endl;
for (auto const &f: workflow->getInputFiles()) {
simulation->stageFile(f, storage_service);
storage_service->createFile(f);
}

simulation->getOutput().enableWorkflowTaskTimestamps(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int main(int argc, char **argv) {

std::cerr << "Staging task input files..." << std::endl;
for (auto const &f: workflow->getInputFiles()) {
simulation->stageFile(f, storage_service);
storage_service->createFile(f);
}

simulation->getOutput().enableWorkflowTaskTimestamps(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ int main(int argc, char **argv) {
* 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_service);
storage_service->createFile(f);
}

/* Launch the simulation. This call only returns when the simulation is complete. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int main(int argc, char **argv) {

// Stage the input_file on the storage service
for (auto const &f: workflow->getInputFiles()) {
simulation->stageFile(f, local_ss);
local_ss->createFile(f);
}

// Run the simulation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int main(int argc, char **argv) {
std::cerr << "Staging input files..." << std::endl;
for (auto const &f: workflow->getInputFiles()) {
try {
simulation->stageFile(f, storage_service);
storage_service->createFile(f);
} catch (std::runtime_error &e) {
std::cerr << "Exception: " << e.what() << std::endl;
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ TEST_F(BareMetalComputeServiceOneActionTest, ServiceSuspended) {
void BareMetalComputeServiceOneActionTest::do_OneSleepActionServiceSuspended_test() {
// Create and initialize a simulation
auto simulation = wrench::Simulation::createSimulation();

x2
int argc = 1;
auto argv = (char **) calloc(argc, sizeof(char *));
argv[0] = strdup("one_action_test");
Expand Down
22 changes: 21 additions & 1 deletion tools/wrench/wrench-init/base_code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ if (DEFINED SimGrid_PATH)
endif()
find_package(SimGrid REQUIRED)

# Find SimGrid's FS module
if (DEFINED FSMOD_PATH)
if (NOT EXISTS "${FSMOD_PATH}")
message(FATAL_ERROR "The specified FSMOD_PATH doesn't exit")
else()
file(GLOB LIBFSMOD_FILES
"${FSMOD_PATH}/liblibfsmod.so"
"${FSMOD_PATH}/lib/libfsmod.dylib"
)
if (NOT LIBFSMOD_FILES)
message(FATAL_ERROR "The specified FSMOD_PATH doesn't seem to contain a valid FSMod installation")
else()
set(CMAKE_PREFIX_PATH ${FSMOD_PATH} ${CMAKE_PREFIX_PATH})
endif()
endif()
endif()
find_package(FSMod REQUIRED)

# Find WRENCH
if (DEFINED WRENCH_PATH)
if (NOT EXISTS "${WRENCH_PATH}")
Expand All @@ -53,7 +71,7 @@ find_package(WRENCH REQUIRED)


# include directories
include_directories(include/ /usr/local/include/ /opt/local/include/ ${WRENCH_INCLUDE_DIR} ${SimGrid_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
include_directories(include/ /usr/local/include/ /opt/local/include/ ${WRENCH_INCLUDE_DIR} ${SimGrid_INCLUDE_DIR} ${FSMOD_INCLUDE_DIR} ${Boost_INCLUDE_DIR})

# source files
set(SOURCE_FILES
Expand All @@ -70,13 +88,15 @@ if (ENABLE_BATSCHED)
target_link_libraries(my-wrench-simulator
${WRENCH_LIBRARY}
${SimGrid_LIBRARY}
${FSMOD_LIBRARY}
${Boost_LIBRARIES}
${WRENCH_WFCOMMONS_WORKFLOW_PARSER_LIBRARY}
-lzmq)
else()
target_link_libraries(my-wrench-simulator
${WRENCH_LIBRARY}
${SimGrid_LIBRARY}
${FSMOD_LIBRARY}
${Boost_LIBRARIES}
${WRENCH_WFCOMMONS_WORKFLOW_PARSER_LIBRARY}
)
Expand Down
2 changes: 1 addition & 1 deletion tools/wrench/wrench-init/base_code/Simulator_WORKFLOW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int main(int argc, char **argv) {

/* Stage input files on the storage service */
for (auto const &f: workflow->getInputFiles()) {
simulation->stageFile(f, storage_service);
storage_service->createFile(f);
}

/* Launch the simulation */
Expand Down
5 changes: 5 additions & 0 deletions tools/wrench/wrench-init/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ cat $1"/conf/cmake/FindSimGrid.cmake"
echo "\"\"\""
echo ""

echo "FILE_CONTENT_FINDFSMOD_CMAKE = r\"\"\""
cat $1"/conf/cmake/FindFSMod.cmake"
echo "\"\"\""
echo ""

echo "FILE_CONTENT_FINDWRENCH_CMAKE = r\"\"\""
cat $1"/FindWRENCH.cmake"
echo "\"\"\""
Expand Down
1 change: 1 addition & 0 deletions tools/wrench/wrench-init/wrench-init.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def main():
_create_file(FILE_CONTENT_README_MD, args.project_dir + "/README.md")
_create_file(FILE_CONTENT_CMAKELISTS_TXT, args.project_dir + "/CMakeLists.txt")
_create_file(FILE_CONTENT_FINDSIMGRID_CMAKE, args.project_dir + "/CMakeModules/FindSimGrid.cmake")
_create_file(FILE_CONTENT_FINDFSMOD_CMAKE, args.project_dir + "/CMakeModules/FindFSMod.cmake")
_create_file(FILE_CONTENT_FINDWRENCH_CMAKE, args.project_dir + "/CMakeModules/FindWRENCH.cmake")
_create_file(FILE_CONTENT_PLATFORM_XML, args.project_dir + "/data/platform.xml")

Expand Down

0 comments on commit f2945ad

Please sign in to comment.