Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merging changes done by Steven, Samuel and Luka, regarding simulation of StarPU-MPI
[simgrid.git] / include / simgrid / host.h
1 /* Copyright (c) 2013-2015. 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 SIMGRID_HOST_H_
8 #define SIMGRID_HOST_H_
9
10 #include <xbt/dict.h>
11 #include <xbt/dynar.h>
12
13 #include <simgrid/forward.h>
14
15 SG_BEGIN_DECL()
16
17 XBT_PUBLIC(sg_host_t) sg_host_by_name(const char *name);
18 XBT_PUBLIC(sg_host_t) sg_host_by_name_or_create(const char *name);
19 static XBT_INLINE char *sg_host_get_name(sg_host_t host){
20         return host->key;
21 }
22 XBT_PUBLIC(xbt_dynar_t) sg_hosts_as_dynar(void);
23
24 // ========== User Data ==============
25 XBT_PUBLIC(void*) sg_host_user(sg_host_t host);
26 XBT_PUBLIC(void) sg_host_user_set(sg_host_t host, void* userdata);
27 XBT_PUBLIC(void) sg_host_user_destroy(sg_host_t host);
28
29 // ========== MSG Layer ==============
30 typedef struct s_msg_host_priv *msg_host_priv_t;
31 msg_host_priv_t sg_host_msg(sg_host_t host);
32 XBT_PUBLIC(void) sg_host_msg_set(sg_host_t host, msg_host_priv_t priv);
33 XBT_PUBLIC(void) sg_host_msg_destroy(sg_host_t host);
34
35 // ========== SD Layer ==============
36 typedef struct SD_workstation *SD_workstation_priv_t;
37 SD_workstation_priv_t sg_host_sd(sg_host_t host);
38 XBT_PUBLIC(void) sg_host_sd_set(sg_host_t host, SD_workstation_priv_t priv);
39 XBT_PUBLIC(void) sg_host_sd_destroy(sg_host_t host);
40
41 // ========== Simix layer =============
42 typedef struct s_smx_host_priv *smx_host_priv_t;
43 XBT_PUBLIC(smx_host_priv_t) sg_host_simix(sg_host_t host);
44 XBT_PUBLIC(void) sg_host_simix_set(sg_host_t host, smx_host_priv_t priv);
45 XBT_PUBLIC(void) sg_host_simix_destroy(sg_host_t host);
46
47 // ========== SURF CPU ============
48 XBT_PUBLIC(surf_cpu_t) sg_host_surfcpu(sg_host_t host);
49 XBT_PUBLIC(void) sg_host_surfcpu_set(sg_host_t host, surf_cpu_t cpu);
50 XBT_PUBLIC(void) sg_host_surfcpu_register(sg_host_t host, surf_cpu_t cpu);
51 XBT_PUBLIC(void) sg_host_surfcpu_destroy(sg_host_t host);
52
53 // ========== RoutingEdge ============
54 XBT_PUBLIC(routing_edge_t) sg_host_edge(sg_host_t host);
55 XBT_PUBLIC(void) sg_host_edge_set(sg_host_t host, routing_edge_t edge);
56 XBT_PUBLIC(void) sg_host_edge_destroy(sg_host_t host, int do_callback);
57
58
59 // Module initializer. Won't survive the conversion to C++. Hopefully.
60 XBT_PUBLIC(void) sg_host_init(void);
61
62 // =========== user-level functions ===============
63 XBT_PUBLIC(double) sg_host_get_speed(sg_host_t host);
64 XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host);
65 XBT_PUBLIC(int) sg_host_get_core(sg_host_t host);
66 XBT_PUBLIC(int) sg_host_get_state(sg_host_t host);
67
68 XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host);
69 XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host);
70 XBT_PUBLIC(double) sg_host_get_consumed_energy(sg_host_t host);
71
72 SG_END_DECL()
73
74 #endif /* SIMGRID_HOST_H_ */