improved planner

This commit is contained in:
ALEXks
2025-03-03 13:36:20 +03:00
parent e98127880b
commit 9b02a5c9ea
2 changed files with 10 additions and 3 deletions

View File

@@ -114,6 +114,7 @@ public:
changeState(); changeState();
} }
vector<T*> taskList;
map<int, queue<T*>, std::greater<int>> sortedByKernelNeeds; map<int, queue<T*>, std::greater<int>> sortedByKernelNeeds;
size_t activeTasks = 0; size_t activeTasks = 0;
size_t totalProcessTasks = 0; size_t totalProcessTasks = 0;
@@ -126,6 +127,7 @@ public:
sortedByKernelNeeds[task->getKernels()].push(task); sortedByKernelNeeds[task->getKernels()].push(task);
if (maxNeededKernels < task->getKernels()) if (maxNeededKernels < task->getKernels())
maxNeededKernels = task->getKernels(); maxNeededKernels = task->getKernels();
taskList.push_back(task);
} }
} }
@@ -155,7 +157,7 @@ public:
vector<T*> toDel; vector<T*> toDel;
size_t done = 0; size_t done = 0;
size_t step = ceil(totalProcessTasks * 0.01); // step == 1% size_t step = ceil(totalProcessTasks * 0.02); // step == 2%
const double total = totalProcessTasks; const double total = totalProcessTasks;
auto timer_start = Utils::getAbsoluteTime(); auto timer_start = Utils::getAbsoluteTime();
@@ -206,7 +208,8 @@ public:
printf(" done task with %d kernels and id %ld\n", task->getKernels(), task->getId()); printf(" done task with %d kernels and id %ld\n", task->getKernels(), task->getId());
#endif #endif
buf += to_string(task->getId()) + " " + string(task->printState().getCharArray()) + " " + to_string(task->getTotalTime()) + "\n"; buf += to_string(task->getId()) + " " + string(task->printState().getCharArray()) + " " + to_string(task->getTotalTime()) + "\n";
task->copyResults(pathRes); //copy after end of while
//task->copyResults(pathRes);
} }
} }
@@ -235,6 +238,9 @@ public:
} }
} }
for (auto& task : taskList)
task->copyResults(pathRes);
changeState(); changeState();
String outFile(pathRes + "/" + getStatePrefix() + "Info.txt"); String outFile(pathRes + "/" + getStatePrefix() + "Info.txt");
@@ -250,6 +256,7 @@ public:
FILE *f = fopen("progress", "w"); FILE *f = fopen("progress", "w");
if (f) { if (f) {
fprintf(f, "%lld", persentDone); fprintf(f, "%lld", persentDone);
fflush(f);
fclose(f); fclose(f);
} }
} }

View File

@@ -1 +1 @@
10 11