Skip to content

Commit

Permalink
faster?
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Apr 27, 2021
1 parent 86fd727 commit f51ef3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
13 changes: 12 additions & 1 deletion src/Util/WorkflowUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#ifdef PRINT_RAM_MACOSX
#include<mach/mach.h>
#endif
#include <unordered_map>

#include "WorkflowUtil.h"

Expand All @@ -24,6 +25,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(workflow_util, "Log category for Workflow Util");

namespace wrench {

std::unordered_map<WorkflowTask*, std::vector<WorkflowTask*>> lineage;

#ifdef PRINT_RAM_MACOSX
void WorkflowUtil::printRAM() {

Expand Down Expand Up @@ -56,6 +59,14 @@ namespace wrench {
double WorkflowUtil::estimateMakespan(std::vector<WorkflowTask *> tasks,
unsigned long num_hosts, double core_speed) {

if (lineage.empty()) {
auto workflow = (*tasks.begin())->getWorkflow();
for (auto task : workflow->getTasks()) {
std::vector<WorkflowTask *> parents = task->getParents();
lineage[task] = parents;
}
}

if (num_hosts == 0) {
throw std::runtime_error("Cannot estimate makespan with 0 hosts!");
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f51ef3d

Please sign in to comment.