Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid
[simgrid.git] / include / msg / datatypes.h
1 /* Copyright (c) 2004, 2005, 2007, 2008, 2009, 2010. 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/file_stat.h"
11 #include "simgrid_config.h"     // for HAVE_TRACING
12
13 SG_BEGIN_DECL()
14
15 /* ******************************** Host ************************************ */
16
17 /** @defgroup m_datatypes_management_details Details on MSG datatypes
18     @ingroup  m_datatypes_management*/
19 typedef struct simdata_host *simdata_host_t;
20
21 /** @brief Host datatype 
22     @ingroup m_datatypes_management_details */
23 typedef struct m_host {
24   char *name;                   /**< @brief host name if any */
25   simdata_host_t simdata;       /**< @brief simulator data */
26   void *data;                   /**< @brief user data */
27 } s_m_host_t;
28
29 /** @brief Host datatype  
30     @ingroup m_datatypes_management
31
32     A <em>location</em> (or <em>host</em>) is any possible place where
33     a process may run. Thus it is represented as a <em>physical
34     resource with computing capabilities</em>, some <em>mailboxes</em>
35     to enable running process to communicate with remote ones, and
36     some <em>private data</em> that can be only accessed by local
37     process.
38
39     \see m_host_management
40   @{ */
41 typedef struct m_host *m_host_t;
42 /** @} */
43
44 /* ******************************** Task ************************************ */
45
46 typedef struct simdata_task *simdata_task_t;
47
48 /** @brief Task datatype 
49     @ingroup m_datatypes_management_details */
50 typedef struct m_task {
51   char *name;                   /**< @brief task name if any */
52   simdata_task_t simdata;       /**< @brief simulator data */
53   void *data;                   /**< @brief user data */
54 #ifdef HAVE_TRACING
55   long long int counter;        /* task unique identifier for instrumentation */
56   char *category;               /* task category for instrumentation */
57 #endif
58 } s_m_task_t;
59
60 /** @brief Task datatype  
61     @ingroup m_datatypes_management 
62
63     A <em>task</em> may then be defined by a <em>computing
64     amount</em>, a <em>message size</em> and some <em>private
65     data</em>.
66     \see m_task_management
67   @{ */
68 typedef struct m_task *m_task_t;
69
70 /* ******************************** File ************************************ */
71
72 typedef struct simdata_file *simdata_file_t;
73
74 /** @brief File datatype
75     @ingroup m_datatypes_management_details */
76 typedef struct msg_file {
77   char *name;                   /**< @brief file name */
78   simdata_file_t simdata;                /**< @brief simulator data  */
79   void *data;                   /**< @brief user data */
80 } s_msg_file_t;
81 /** @brief File datatype
82     @ingroup m_datatypes_management_details */
83
84 typedef struct msg_file *msg_file_t;
85
86 typedef s_file_stat_t s_msg_stat_t, *msg_stat_t;
87
88
89 /*************** Begin GPU ***************/
90 typedef struct simdata_gpu_task *simdata_gpu_task_t;
91
92 /** @brief GPU task datatype
93     @ingroup m_datatypes_management_details */
94 typedef struct m_gpu_task {
95   char *name;                   /**< @brief task name if any */
96   simdata_gpu_task_t simdata;       /**< @brief simulator data */
97 #ifdef HAVE_TRACING
98   long long int counter;        /* task unique identifier for instrumentation */
99   char *category;               /* task category for instrumentation */
100 #endif
101 } s_m_gpu_task_t;
102
103 /** @brief GPU task datatype
104     @ingroup m_datatypes_management
105
106     A <em>task</em> may then be defined by a <em>computing
107     amount</em>, a <em>dispatch latency</em> and a <em>collect latency</em>.
108     \see m_task_management
109   @{ */
110 typedef struct m_gpu_task *m_gpu_task_t;
111 /*************** End GPU ***************/
112
113 /**
114  * \brief @brief Communication action
115  * \ingroup m_datatypes_management
116  *
117  * Communication actions transfer tasks between processes.
118  * For a given task, the sender and the receiver have distinct objects.
119  */
120 typedef struct msg_comm *msg_comm_t;
121
122 /** \brief Default value for an uninitialized #m_task_t.
123     \ingroup m_datatypes_management 
124 */
125 #define MSG_TASK_UNINITIALIZED NULL
126
127 /** @} */
128
129 /* ****************************** Process *********************************** */
130
131 /** @brief Process datatype
132     @ingroup m_datatypes_management 
133
134     A process may be defined as a <em>code</em>, with some <em>private
135     data</em>, executing in a <em>location</em>.
136     \see m_process_management
137   @{ */
138 typedef struct s_smx_process *m_process_t;
139 /** @} */
140
141 #ifdef MSG_USE_DEPRECATED
142 /* ********************************* Channel ******************************** */
143 /** @brief Channel datatype  
144     @ingroup msg_deprecated_functions
145
146     A <em>channel</em>  is a number and identifies a mailbox type (just as a 
147     port number does).
148     \see m_channel_management
149    @{ */
150 typedef int m_channel_t;
151 /** @} */
152 #endif
153
154 /* ******************************** Mailbox ************************************ */
155
156 typedef struct s_smx_rvpoint *msg_mailbox_t;
157 /** @brief Mailbox datatype
158     @ingroup m_datatypes_management_details @{ */
159
160 void MSG_mailbox_free(void *mailbox);
161
162
163 /** @} */
164
165
166 /* ***************************** Error handling ***************************** */
167 /** @brief Error handling 
168     @ingroup m_datatypes_management 
169          @{
170 *//* Keep these code as binary values: java bindings manipulate | of these values */
171 typedef enum {
172   MSG_OK = 0,                 /**< @brief Everything is right. Keep on going this way ! */
173   MSG_TIMEOUT = 1,            /**< @brief nothing good happened before the timer you provided elapsed */
174   MSG_TRANSFER_FAILURE = 2,   /**< @brief There has been a problem during you task
175       transfer. Either the network is down or the remote host has been
176       shutdown. */
177   MSG_HOST_FAILURE = 4,       /**< @brief System shutdown. The host on which you are
178       running has just been rebooted. Free your datastructures and
179       return now !*/
180   MSG_TASK_CANCELED = 8      /**< @brief Canceled task. This task has been canceled by somebody!*/
181 } MSG_error_t;
182 /** @} */
183
184
185 SG_END_DECL()
186 #endif