Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix jedule builds
[simgrid.git] / include / simgrid / jedule / jedule_platform.hpp
1 /* Copyright (c) 2010-2012, 2014-2016. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef JED_SIMGRID_PLATFORM_H_
8 #define JED_SIMGRID_PLATFORM_H_
9
10 #include "simgrid_config.h"
11 #include "simgrid/forward.h"
12 #include "xbt/dynar.h"
13 #include <unordered_map>
14 #include <vector>
15 #include <string>
16 #if HAVE_JEDULE
17
18 namespace simgrid {
19 namespace jedule{
20 XBT_PUBLIC_CLASS Container {
21 public:
22   Container(std::string name);
23   virtual ~Container();
24 private:
25   int last_id;
26   int is_lowest = 0;
27 public:
28   std::string name;
29   std::unordered_map<const char*, unsigned int> name2id;
30   Container *parent = nullptr;
31   std::vector<Container*> children;
32   std::vector<sg_host_t> resource_list;
33   void addChild(Container* child);
34   void addResources(std::vector<sg_host_t> hosts);
35   void createHierarchy(NetZone_t from_as);
36   std::vector<int> getHierarchy();
37   std::string getHierarchyAsString();
38   void print(FILE *file);
39   void printResources(FILE *file);
40 };
41
42 XBT_PUBLIC_CLASS Subset {
43 public:
44   Subset(int s, int n, Container* p);
45   virtual ~Subset()=default;
46   int start_idx; // start idx in resource_list of container
47   int nres;      // number of resources spanning starting at start_idx
48   Container *parent;
49 };
50
51 }
52 }
53 SG_BEGIN_DECL()
54 typedef simgrid::jedule::Container * jed_container_t;
55 typedef simgrid::jedule::Subset * jed_subset_t;
56 void get_resource_selection_by_hosts(std::vector<jed_subset_t>* subset_list, std::vector<sg_host_t> *host_list);
57
58 SG_END_DECL()
59
60 #endif
61
62 #endif /* JED_SIMGRID_PLATFORM_H_ */