-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster.h
42 lines (38 loc) · 930 Bytes
/
cluster.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef CLUSTER_H
#define CLUSTER_H
#include "a100.h"
#include "job.h"
#include "logger.h"
#include "instance.h"
class Cluster
{
private:
int ngpu, algo;
double util;
bool heavy;
tt timer;
Logger *logger;
vector<A100> gpus;
vector<Job*> jobs;
vector<int> resource;
queue<Job*> job_queue;
priority_queue<Job*, vector<Job*>, compareFT> running_queue;
vector<priority_queue<Job*, vector<Job*>, compareArrival>> readyJobs;
public:
Cluster();
Cluster(int ngpu, Logger *logger, int algo);
void run();
void newJob(Job *j);
void updateStatus();
void finishJob(Job *j);
void schedule();
void myAlgo();
void bestfit();
void worstfit();
vector<Job*> myScheduling();
vector<Job*> AFCFS_Scheduling();
void myPlacement(vector<Job*> &plan);
void bestfitPlacement(vector<Job*> &plan);
void worstfitPlacement(vector<Job*> &plan);
};
#endif