1 /* Copyright (c) 2010-2012, 2014-2015. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef JED_SIMGRID_PLATFORM_H_
8 #define JED_SIMGRID_PLATFORM_H_
10 #include "simgrid_config.h"
11 #include "simgrid/forward.h"
12 #include "xbt/dynar.h"
14 #include <unordered_map>
22 XBT_PUBLIC_CLASS Container {
24 Container(std::string name);
25 virtual ~Container()=default;
31 std::unordered_map<const char*, int> name2id;
32 Container *parent = nullptr;
33 std::vector<Container*> children;
34 std::vector<sg_host_t> resource_list;
35 void addChild(Container* child);
36 void addResources(std::vector<sg_host_t> hosts);
37 void createHierarchy(AS_t from_as);
38 std::vector<int> getHierarchy();
39 std::string getHierarchyAsString();
40 void print(FILE *file);
41 void printResources(FILE *file);
47 typedef simgrid::jedule::Container * jed_container_t;
49 /* FIXME: jedule_container should be objectified too */
50 /** selection of a subset of resources from the original set */
51 struct jed_res_subset {
52 jed_container_t parent;
53 int start_idx; // start idx in resource_list of container
54 int nres; // number of resources spanning starting at start_idx
57 typedef struct jed_res_subset s_jed_res_subset_t, *jed_res_subset_t;
59 /* FIXME: jedule should be objectified too */
61 typedef struct jedule_struct {
62 jed_container_t root_container;
63 std::unordered_map<char*, char*> jedule_meta_info;
66 typedef s_jedule_t *jedule_t;
68 void jed_create_jedule(jedule_t *jedule);
69 void jed_free_jedule(jedule_t jedule);
70 void jedule_add_meta_info(jedule_t jedule, char *key, char *value);
73 * it is assumed that the host_names in the entire system are unique that means that we don't need parent references
75 * subset_list must be allocated
76 * host_names is the list of host_names associated with an event
78 void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, std::vector<sg_host_t>* host_list);
82 hash host_id -> container
84 hash host_id -> jed_host_id
85 list <- [ jed_host_ids ]
87 list_chunks <- chunk( list ) -> [ 1, 3-5, 7-9 ]
94 #endif /* JED_SIMGRID_PLATFORM_H_ */