diff --git a/CMakeLists.txt b/CMakeLists.txt index a462d59..7c70c89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.2) message(STATUS "Cmake version ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}") project(task_clustering_batch_simulator) add_definitions("-Wall -Wno-unused-variable -Wno-unused-private-field") -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 14) set(CMAKE_BUILD_TYPE release) diff --git a/src/Util/WorkflowUtil.cpp b/src/Util/WorkflowUtil.cpp index fb938a4..378496d 100644 --- a/src/Util/WorkflowUtil.cpp +++ b/src/Util/WorkflowUtil.cpp @@ -16,6 +16,7 @@ #ifdef PRINT_RAM_MACOSX #include #endif +#include #include "WorkflowUtil.h" @@ -24,6 +25,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(workflow_util, "Log category for Workflow Util"); namespace wrench { +std::unordered_map> lineage; + #ifdef PRINT_RAM_MACOSX void WorkflowUtil::printRAM() { @@ -56,6 +59,14 @@ namespace wrench { double WorkflowUtil::estimateMakespan(std::vector tasks, unsigned long num_hosts, double core_speed) { + if (lineage.empty()) { + auto workflow = (*tasks.begin())->getWorkflow(); + for (auto task : workflow->getTasks()) { + std::vector parents = task->getParents(); + lineage[task] = parents; + } + } + if (num_hosts == 0) { throw std::runtime_error("Cannot estimate makespan with 0 hosts!"); } @@ -113,7 +124,7 @@ namespace wrench { // Determine whether the task is schedulable bool schedulable = true; - for (auto parent : workflow->getTaskParents(real_task)) { + for (auto parent : lineage[real_task]) { if ((fake_tasks[parent] > current_time) or (fake_tasks[parent] < 0)) { schedulable = false;