ExaTN
scheduler.hpp
1 #ifndef SCHEDULER_HPP_
2 #define SCHEDULER_HPP_
3 
4 //#include <mpi.h>
5 #include <iostream>
6 #include <string>
7 using namespace std;
8 
9 namespace exatn {
10 namespace numerics {
11  int proc_cnt; //currently serves as the resource count
12 
13  struct Task {
14  string cmds;
15  int num_procs;
16  };
17 
18  struct Job {
19  int id;
20  Task tsk;
21  string System;
22  Job *next_job;
23 
24  Job (){ }
25 
26  Job(Task t, string s)
27  {
28  tsk=t;
29  System=s;
30  id=-1;
31  next_job=NULL;
32  }
33 
34  Job(Task t, string s, int i)
35  {
36  tsk=t;
37  System=s;
38  id=i;
39  next_job=NULL;
40  }
41  };
42 
43  class Job_Queue {
44  private:
45  int jobid_cnt;
46  int qcnt;
47  public:
48  Job *first_job;
49  Job *last_job;
50 
51  Job_Queue();
52 
53  //returns true if the queue is empty
54  bool queue_empty();
55 
56  void print_queue();
57 
58  Job* get_next_job();
59 
60  Job* get_job_with_id(int id);
61 
62  void add_job(Job *j, bool is_newj, bool is_runj);
63 
64  void remove_job(Job *j, bool is_runj);
65  };
66 
67 
68  class Scheduler {
69  public:
70  Job_Queue *waitq;
71  Job_Queue *runq;
72 
73  Scheduler();
74 
75  void Job_Submit(string cmds, int np);
76 
77  int Launch_Job( );
78 
79  void Job_Done(int jb_id);
80  };
81 }
82 }
83 #endif //SCHEDULER_HPP_
exatn::numerics::Job
Definition: scheduler.hpp:18
exatn::numerics::Job_Queue
Definition: scheduler.hpp:43
exatn
Definition: DriverClient.hpp:10
exatn::numerics::Scheduler
Definition: scheduler.hpp:68
exatn::numerics::Task
Definition: scheduler.hpp:13