60 lines
1.1 KiB
C++
Executable File
60 lines
1.1 KiB
C++
Executable File
|
|
#pragma once
|
|
|
|
|
|
#include <mutex>
|
|
#include <thread>
|
|
#include <utility>
|
|
#include <queue>
|
|
#include <memory>
|
|
#include <map>
|
|
#include <atomic>
|
|
#include <condition_variable>
|
|
|
|
namespace wfr {
|
|
namespace scheduling {
|
|
class SchedulingDecision;
|
|
class AbstractScheduler;
|
|
class PThreadBackend;
|
|
}
|
|
namespace execution {
|
|
class PThreadBackend;
|
|
class CudaBackend;
|
|
}
|
|
|
|
|
|
namespace execution {
|
|
|
|
|
|
class ExecutionHandle;
|
|
|
|
class ExecutionManager {
|
|
private:
|
|
ExecutionManager();
|
|
static ExecutionManager singleton;
|
|
|
|
std::mutex managerMutex;
|
|
|
|
PThreadBackend* pThreadBackend = nullptr;
|
|
CudaBackend* cudaBackend = nullptr;
|
|
|
|
std::map<ExecutionHandle*, scheduling::AbstractScheduler*> schedulerHandleMap;
|
|
std::queue<ExecutionHandle*> updateQueue;
|
|
|
|
public:
|
|
static void init(int argc, char** argv);
|
|
|
|
static void finish();
|
|
|
|
~ExecutionManager();
|
|
|
|
static ExecutionManager& getInstance() { return singleton; }
|
|
|
|
bool executeSchedulingDecision(std::shared_ptr<scheduling::SchedulingDecision> sd, scheduling::AbstractScheduler& scheduler);
|
|
|
|
void notifyExecutionHandleUpdate(ExecutionHandle& handle);
|
|
};
|
|
|
|
} /* namespace execution */
|
|
} /* namespace wfr */
|