Skip to content

Commit

Permalink
Documentation++
Browse files Browse the repository at this point in the history
Made WfCommons workflow parsing throw a warning (and fix it) is a
WfFormat instance shows coreCount=0 for a task
  • Loading branch information
henricasanova committed Sep 13, 2024
1 parent f0b7549 commit 7bdf751
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/wrench/action/ComputeAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace wrench {
unsigned long min_num_cores,
unsigned long max_num_cores,
std::shared_ptr<ParallelModel> parallel_model) : Action(name, "compute_") {

if ((flops < 0) || (ram < 0) || (min_num_cores < 1) || (max_num_cores < min_num_cores)) {
throw std::invalid_argument("ComputeAction::ComputeAction(): invalid arguments");
}
Expand Down Expand Up @@ -157,4 +158,4 @@ namespace wrench {
WRENCH_INFO("All compute threads have completed successfully");
}

}// namespace wrench
}// namespace wrench
6 changes: 6 additions & 0 deletions tools/wfcommons/src/WfCommonsWorkflowParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ namespace wrench {
} catch (nlohmann::json::out_of_range &e) {
// do nothing
}
if (num_cores <= 0) {
if (show_warnings) std::cerr << "[WARNING]: Task " << task->getID() <<
" specifies an invalid number of cores (" +
std::to_string(num_cores) + "): Assuming 1 core instead.\n";
num_cores = 1;
}

double runtimeInSeconds = task_exec.at("runtimeInSeconds");
// Scale runtime based on avgCPU unless disabled
Expand Down
2 changes: 1 addition & 1 deletion tools/wrench/wrench-daemon/doc/wrench-openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2627,7 +2627,7 @@
},
"parallel_model": {
"type": "tuple",
"description": "Info for making parallel model."
"description": "Info for making parallel model as a (string, float) tuple. The string is the parallel model type, which can be AMDAHL or CONSTANTEFFICIENCY. Each model takes a float parameter between 0.0 and 1.0. The AMDAHL model's parameter denotes the fraction of the sequential execution time that is perfectly parallelizable. The CONSTANTEFFICIENCY model's parameter is simply the parallel efficiency"
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions tools/wrench/wrench-daemon/src/SimulationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,8 @@ namespace wrench {
model = ParallelModel::AMDAHL(value);
} else if (model_type == "CONSTANTEFFICIENCY") {
model = ParallelModel::CONSTANTEFFICIENCY(value);
} else {
throw std::runtime_error("Unknown parallel model type " + model_type);
}

auto action = compound_job->addComputeAction(compute_action_name, flops, ram, min_num_cores, max_num_cores, model);
Expand Down

0 comments on commit 7bdf751

Please sign in to comment.