Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I blame someone else for this
[simgrid.git] / include / msg / datatypes.h
1 /* Copyright (c) 2004-2013. 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 MSG_DATATYPE_H
8 #define MSG_DATATYPE_H
9 #include "xbt/misc.h"
10 #include "xbt/lib.h"
11 #include "simgrid/simix.h"
12 #include "simgrid_config.h"     // for HAVE_TRACING
13
14 SG_BEGIN_DECL()
15
16 /* ******************************** Mailbox ************************************ */
17
18 /** @brief Mailbox datatype
19  *  @ingroup msg_task_usage
20  *
21  * Object representing a communication rendez-vous point, on which
22  * the sender finds the receiver it wants to communicate with. As a
23  * MSG user, you will only rarely manipulate any of these objects
24  * directly, since most of the public interface (such as
25  * #MSG_task_send and friends) hide this object behind a string
26  * alias. That mean that you don't provide the mailbox on which you
27  * want to send your task, but only the name of this mailbox. */
28 typedef struct s_smx_rvpoint *msg_mailbox_t;
29
30 /* ******************************** Environment ************************************ */
31 typedef struct s_as *msg_as_t;
32
33 /* ******************************** Host ************************************ */
34
35 extern int MSG_HOST_LEVEL;
36
37 /** @brief Host datatype.
38     @ingroup m_host_management
39
40     A <em>location</em> (or <em>host</em>) is any possible place where
41     a process may run. Thus it is represented as a <em>physical
42     resource with computing capabilities</em>, some <em>mailboxes</em>
43     to enable running process to communicate with remote ones, and
44     some <em>private data</em> that can be only accessed by local
45     process.
46  */
47 typedef xbt_dictelm_t msg_host_t;
48 typedef s_xbt_dictelm_t s_msg_host_t;
49
50 typedef struct msg_host_priv {
51   xbt_swag_t vms;
52 #ifdef MSG_USE_DEPRECATED
53   msg_mailbox_t *mailboxes;     /**< the channels  */
54 #endif
55 } s_msg_host_priv_t, *msg_host_priv_t;
56
57 static inline msg_host_priv_t MSG_host_priv(msg_host_t host){
58   return (msg_host_priv_t )xbt_lib_get_level(host, MSG_HOST_LEVEL);
59 }
60
61
62
63 /* ******************************** Task ************************************ */
64
65 typedef struct simdata_task *simdata_task_t;
66
67 typedef struct msg_task {
68   char *name;                   /**< @brief task name if any */
69   simdata_task_t simdata;       /**< @brief simulator data */
70   void *data;                   /**< @brief user data */
71 #ifdef HAVE_TRACING
72   long long int counter;        /* task unique identifier for instrumentation */
73   char *category;               /* task category for instrumentation */
74 #endif
75 } s_msg_task_t;
76
77 /** @brief Task datatype.
78     @ingroup m_task_management 
79
80     A <em>task</em> may then be defined by a <em>computing
81     amount</em>, a <em>message size</em> and some <em>private
82     data</em>.
83  */
84 typedef struct msg_task *msg_task_t;
85
86 /* ********************************  VM ************************************* */
87 typedef struct msg_vm *msg_vm_t;
88
89 typedef enum {
90   msg_vm_state_suspended, msg_vm_state_running, msg_vm_state_migrating
91 } e_msg_vm_state_t;
92
93 typedef struct msg_vm {
94   char *name;
95   s_xbt_swag_hookup_t all_vms_hookup;
96   s_xbt_swag_hookup_t host_vms_hookup;
97   xbt_dynar_t processes;
98   e_msg_vm_state_t state;
99   msg_host_t location;
100   int coreAmount;
101 } s_msg_vm_t;
102
103 /* ******************************** File ************************************ */
104 typedef struct simdata_file *simdata_file_t;
105
106 typedef struct s_msg_file_info {
107   sg_storage_size_t size;
108   char* mount_point;
109   char* storageId;
110   char* storage_type;
111   char* content_type;
112 } s_msg_file_info_t, *msg_file_info_t;
113
114 typedef struct msg_file {
115   char *fullname;               /**< @brief file full name (path+name)*/
116   simdata_file_t simdata;       /**< @brief simulator data  */
117   msg_file_info_t info;
118 } s_msg_file_t;
119
120 /** @brief File datatype.
121  *  @ingroup msg_file_management
122  *
123  *  You should consider this as an opaque object.
124  */
125
126 typedef struct msg_file *msg_file_t;
127
128 /* ******************************** Storage ************************************ */
129 /* TODO: PV: to comment */
130
131 extern int MSG_STORAGE_LEVEL;
132
133 /** @brief Storage datatype.
134  *  @ingroup msg_storage_management
135  *
136  *  You should consider this as an opaque object.
137  */
138 typedef xbt_dictelm_t msg_storage_t;
139 typedef s_xbt_dictelm_t s_msg_storage_t;
140
141 typedef struct msg_storage_priv  {
142   // TODO PV: fill it (or not) !
143   void * dummy;
144 } s_msg_storage_priv_t, *msg_storage_priv_t;
145
146 /*************** Begin GPU ***************/
147 typedef struct simdata_gpu_task *simdata_gpu_task_t;
148
149 typedef struct msg_gpu_task {
150   char *name;                   /**< @brief task name if any */
151   simdata_gpu_task_t simdata;       /**< @brief simulator data */
152 #ifdef HAVE_TRACING
153   long long int counter;        /* task unique identifier for instrumentation */
154   char *category;               /* task category for instrumentation */
155 #endif
156 } s_msg_gpu_task_t;
157
158 /** @brief GPU task datatype.
159     @ingroup m_task_management
160
161     A <em>task</em> may then be defined by a <em>computing
162     amount</em>, a <em>dispatch latency</em> and a <em>collect latency</em>.
163     \see m_task_management
164 */
165 typedef struct msg_gpu_task *msg_gpu_task_t;
166 /*************** End GPU ***************/
167
168 /**
169  * \brief @brief Communication action.
170  * \ingroup msg_task_usage
171  *
172  * Object representing an ongoing communication between processes. Such beast is usually obtained by using #MSG_task_isend, #MSG_task_irecv or friends.
173  */
174 typedef struct msg_comm *msg_comm_t;
175
176 /** \brief Default value for an uninitialized #msg_task_t.
177     \ingroup m_task_management 
178 */
179 #define MSG_TASK_UNINITIALIZED NULL
180
181 /* ****************************** Process *********************************** */
182
183 /** @brief Process datatype.
184     @ingroup m_process_management
185
186     A process may be defined as a <em>code</em>, with some
187     <em>private data</em>, executing in a <em>location</em>. 
188  
189     You should not access directly to the fields of the pointed
190     structure, but always use the provided API to interact with
191     processes.
192  */
193 typedef struct s_smx_process *msg_process_t;
194
195 #ifdef MSG_USE_DEPRECATED
196
197 /* Compatibility typedefs */
198 typedef int                     m_channel_t;
199 typedef msg_gpu_task_t          m_gpu_task_t;
200 typedef msg_host_t              m_host_t;
201 typedef msg_process_t           m_process_t;
202 typedef msg_task_t              m_task_t;
203 typedef s_msg_gpu_task_t        s_m_gpu_task_t;
204 typedef s_msg_host_t            s_m_host_t;
205 typedef s_msg_task_t            s_m_task_t;
206 #endif
207
208 SG_END_DECL()
209 #endif