Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cf624df354b502d8adb7730ff60e847bdc44af46
[simgrid.git] / include / msg / datatypes.h
1 /* Copyright (c) 2004-2012. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef MSG_DATATYPE_H
7 #define MSG_DATATYPE_H
8 #include "xbt/misc.h"
9 #include "xbt/lib.h"
10 #include "simgrid/simix.h"
11 #include "simgrid_config.h"     // for HAVE_TRACING
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
30 /* ******************************** Host ************************************ */
31
32 extern int MSG_HOST_LEVEL;
33
34 /** @brief Host datatype.
35     @ingroup m_host_management
36
37     A <em>location</em> (or <em>host</em>) is any possible place where
38     a process may run. Thus it is represented as a <em>physical
39     resource with computing capabilities</em>, some <em>mailboxes</em>
40     to enable running process to communicate with remote ones, and
41     some <em>private data</em> that can be only accessed by local
42     process.
43  */
44 typedef xbt_dictelm_t msg_host_t;
45 typedef s_xbt_dictelm_t s_msg_host_t;
46
47 typedef struct msg_host_priv {
48   xbt_swag_t vms;
49 #ifdef MSG_USE_DEPRECATED
50   msg_mailbox_t *mailboxes;     /**< the channels  */
51 #endif
52 } s_msg_host_priv_t, *msg_host_priv_t;
53
54 static inline msg_host_priv_t MSG_host_priv(msg_host_t host){
55   return (msg_host_priv_t )xbt_lib_get_level(host, MSG_HOST_LEVEL);
56 }
57
58
59
60 /* ******************************** Task ************************************ */
61
62 typedef struct simdata_task *simdata_task_t;
63
64 typedef struct msg_task {
65   char *name;                   /**< @brief task name if any */
66   simdata_task_t simdata;       /**< @brief simulator data */
67   void *data;                   /**< @brief user data */
68 #ifdef HAVE_TRACING
69   long long int counter;        /* task unique identifier for instrumentation */
70   char *category;               /* task category for instrumentation */
71 #endif
72 } s_msg_task_t;
73
74 /** @brief Task datatype.
75     @ingroup m_task_management 
76
77     A <em>task</em> may then be defined by a <em>computing
78     amount</em>, a <em>message size</em> and some <em>private
79     data</em>.
80  */
81 typedef struct msg_task *msg_task_t;
82
83 /* ********************************  VM ************************************* */
84 typedef struct msg_vm *msg_vm_t;
85
86 typedef enum {
87   msg_vm_state_suspended, msg_vm_state_running, msg_vm_state_migrating
88 } e_msg_vm_state_t;
89
90 typedef struct msg_vm {
91   char *name;
92   s_xbt_swag_hookup_t all_vms_hookup;
93   s_xbt_swag_hookup_t host_vms_hookup;
94   xbt_dynar_t processes;
95   e_msg_vm_state_t state;
96   msg_host_t location;
97   int coreAmount;
98 } s_msg_vm_t;
99
100 /* ******************************** File ************************************ */
101 typedef struct simdata_file *simdata_file_t;
102
103 typedef struct msg_file {
104   char *name;                   /**< @brief file name */
105   simdata_file_t simdata;                /**< @brief simulator data  */
106   void *data;                   /**< @brief user data */
107 } s_msg_file_t;
108
109 /** @brief File datatype.
110     @ingroup msg_file_management 
111  
112     You should consider this as an opaque object.
113  */
114 typedef struct msg_file *msg_file_t;
115
116
117 /** @brief File datatype.
118     @ingroup msg_file_management
119
120     You should consider this as an opaque object.
121  */
122 typedef s_file_stat_t s_msg_stat_t, *msg_stat_t;
123
124
125 /*************** Begin GPU ***************/
126 typedef struct simdata_gpu_task *simdata_gpu_task_t;
127
128 typedef struct msg_gpu_task {
129   char *name;                   /**< @brief task name if any */
130   simdata_gpu_task_t simdata;       /**< @brief simulator data */
131 #ifdef HAVE_TRACING
132   long long int counter;        /* task unique identifier for instrumentation */
133   char *category;               /* task category for instrumentation */
134 #endif
135 } s_msg_gpu_task_t;
136
137 /** @brief GPU task datatype.
138     @ingroup m_task_management
139
140     A <em>task</em> may then be defined by a <em>computing
141     amount</em>, a <em>dispatch latency</em> and a <em>collect latency</em>.
142     \see m_task_management
143 */
144 typedef struct msg_gpu_task *msg_gpu_task_t;
145 /*************** End GPU ***************/
146
147 /**
148  * \brief @brief Communication action.
149  * \ingroup msg_task_usage
150  *
151  * Object representing an ongoing communication between processes. Such beast is usually obtained by using #MSG_task_isend, #MSG_task_irecv or friends.
152  */
153 typedef struct msg_comm *msg_comm_t;
154
155 /** \brief Default value for an uninitialized #msg_task_t.
156     \ingroup m_task_management 
157 */
158 #define MSG_TASK_UNINITIALIZED NULL
159
160 /* ****************************** Process *********************************** */
161
162 /** @brief Process datatype.
163     @ingroup m_process_management
164
165     A process may be defined as a <em>code</em>, with some
166     <em>private data</em>, executing in a <em>location</em>. 
167  
168     You should not access directly to the fields of the pointed
169     structure, but always use the provided API to interact with
170     processes.
171  */
172 typedef struct s_smx_process *msg_process_t;
173
174 #ifdef MSG_USE_DEPRECATED
175
176 /* Compatibility typedefs */
177 typedef int                     m_channel_t;
178 typedef msg_gpu_task_t          m_gpu_task_t;
179 typedef msg_host_t              m_host_t;
180 typedef msg_process_t           m_process_t;
181 typedef msg_task_t              m_task_t;
182 typedef s_msg_gpu_task_t        s_m_gpu_task_t;
183 typedef s_msg_host_t            s_m_host_t;
184 typedef s_msg_task_t            s_m_task_t;
185 #endif
186
187 SG_END_DECL()
188 #endif