Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e69f229643f78d35783884ad9261b3c04f226509
[simgrid.git] / include / msg / datatypes.h
1 /* Copyright (c) 2004-2014. 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 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   int        dp_enabled;
52   xbt_dict_t dp_objs;
53   double     dp_updated_by_deleted_tasks;
54
55   xbt_dict_t affinity_mask_db;
56
57 #ifdef MSG_USE_DEPRECATED
58   msg_mailbox_t *mailboxes;     /**< the channels  */
59 #endif
60 } s_msg_host_priv_t, *msg_host_priv_t;
61
62 static inline msg_host_priv_t MSG_host_priv(msg_host_t host){
63   return (msg_host_priv_t )xbt_lib_get_level(host, MSG_HOST_LEVEL);
64 }
65
66
67
68 /* ******************************** Task ************************************ */
69
70 typedef struct simdata_task *simdata_task_t;
71
72 typedef struct msg_task {
73   char *name;                   /**< @brief task name if any */
74   simdata_task_t simdata;       /**< @brief simulator data */
75   void *data;                   /**< @brief user data */
76 #ifdef HAVE_TRACING
77   long long int counter;        /* task unique identifier for instrumentation */
78   char *category;               /* task category for instrumentation */
79 #endif
80 } s_msg_task_t;
81
82 /** @brief Task datatype.
83     @ingroup m_task_management 
84
85     A <em>task</em> may then be defined by a <em>computing
86     amount</em>, a <em>message size</em> and some <em>private
87     data</em>.
88  */
89 typedef struct msg_task *msg_task_t;
90
91 /* ******************************** VM ************************************* */
92 typedef msg_host_t msg_vm_t;
93 typedef msg_host_priv_t msg_vm_priv_t;
94
95 static inline msg_vm_priv_t MSG_vm_priv(msg_vm_t vm){
96   return (msg_vm_priv_t) xbt_lib_get_level(vm, MSG_HOST_LEVEL);
97 }
98
99 /* ******************************** File ************************************ */
100 //typedef struct simdata_file *simdata_file_t;
101 //
102 //typedef struct s_msg_file_info {
103 //  sg_size_t size;
104 //  char* mount_point;
105 //  char* storageId;
106 //  char* storage_type;
107 //  char* content_type;
108 //} s_msg_file_info_t, *msg_file_info_t;
109 //
110 //typedef struct msg_file {
111 //  char *fullname;               /**< @brief file full name (path+name)*/
112 //  simdata_file_t simdata;       /**< @brief simulator data  */
113 //  msg_file_info_t info;
114 //} s_msg_file_t;
115 //
116 ///** @brief File datatype.
117 // *  @ingroup msg_file_management
118 // *
119 // *  You should consider this as an opaque object.
120 // */
121 //
122 //typedef struct msg_file *msg_file_t;
123 extern int MSG_FILE_LEVEL;
124 typedef struct simdata_file *simdata_file_t;
125
126 typedef xbt_dictelm_t msg_file_t;
127 typedef s_xbt_dictelm_t s_msg_file_t;
128
129 typedef struct msg_file_priv  {
130   const char *fullname;
131   sg_size_t size;
132   char* mount_point;
133   char* storageId;
134   char* storage_type;
135   char* content_type;
136   void *data;
137   simdata_file_t simdata;
138 } s_msg_file_priv_t, *msg_file_priv_t;
139
140 static inline msg_file_priv_t MSG_file_priv(msg_file_t file){
141   return (msg_file_priv_t )xbt_lib_get_level(file, MSG_FILE_LEVEL);
142 }
143
144 /* ******************************** Storage ************************************ */
145 /* TODO: PV: to comment */
146
147 extern int MSG_STORAGE_LEVEL;
148
149 /** @brief Storage datatype.
150  *  @ingroup msg_storage_management
151  *
152  *  You should consider this as an opaque object.
153  */
154 typedef xbt_dictelm_t msg_storage_t;
155 typedef s_xbt_dictelm_t s_msg_storage_t;
156
157 typedef struct msg_storage_priv  {
158   // TODO PV: fill it (or not) !
159   void * dummy;
160 } s_msg_storage_priv_t, *msg_storage_priv_t;
161
162 static inline msg_storage_priv_t MSG_storage_priv(msg_storage_t storage){
163   return (msg_storage_priv_t )xbt_lib_get_level(storage, MSG_STORAGE_LEVEL);
164 }
165
166 /*************** Begin GPU ***************/
167 typedef struct simdata_gpu_task *simdata_gpu_task_t;
168
169 typedef struct msg_gpu_task {
170   char *name;                   /**< @brief task name if any */
171   simdata_gpu_task_t simdata;       /**< @brief simulator data */
172 #ifdef HAVE_TRACING
173   long long int counter;        /* task unique identifier for instrumentation */
174   char *category;               /* task category for instrumentation */
175 #endif
176 } s_msg_gpu_task_t;
177
178 /** @brief GPU task datatype.
179     @ingroup m_task_management
180
181     A <em>task</em> may then be defined by a <em>computing
182     amount</em>, a <em>dispatch latency</em> and a <em>collect latency</em>.
183     \see m_task_management
184 */
185 typedef struct msg_gpu_task *msg_gpu_task_t;
186 /*************** End GPU ***************/
187
188 /**
189  * \brief @brief Communication action.
190  * \ingroup msg_task_usage
191  *
192  * Object representing an ongoing communication between processes. Such beast is usually obtained by using #MSG_task_isend, #MSG_task_irecv or friends.
193  */
194 typedef struct msg_comm *msg_comm_t;
195
196 /** \brief Default value for an uninitialized #msg_task_t.
197     \ingroup m_task_management 
198 */
199 #define MSG_TASK_UNINITIALIZED NULL
200
201 /* ****************************** Process *********************************** */
202
203 /** @brief Process datatype.
204     @ingroup m_process_management
205
206     A process may be defined as a <em>code</em>, with some
207     <em>private data</em>, executing in a <em>location</em>. 
208  
209     You should not access directly to the fields of the pointed
210     structure, but always use the provided API to interact with
211     processes.
212  */
213 typedef struct s_smx_process *msg_process_t;
214
215 #ifdef MSG_USE_DEPRECATED
216
217 /* Compatibility typedefs */
218 typedef int                     m_channel_t;
219 typedef msg_gpu_task_t          m_gpu_task_t;
220 typedef msg_host_t              m_host_t;
221 typedef msg_process_t           m_process_t;
222 typedef msg_task_t              m_task_t;
223 typedef s_msg_gpu_task_t        s_m_gpu_task_t;
224 typedef s_msg_host_t            s_m_host_t;
225 typedef s_msg_task_t            s_m_task_t;
226 #endif
227
228 SG_END_DECL()
229 #endif