Logo AND Algorithmique Numérique Distribuée

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