Logo AND Algorithmique Numérique Distribuée

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