Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix namespace for transition pattern code
[simgrid.git] / src / mc / mc_comm_pattern.h
1 /* Copyright (c) 2007-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 #include <stdint.h>
8
9 #include <simgrid_config.h>
10 #include <xbt/dynar.h>
11
12 #include "../simix/smx_private.h"
13 #include "../smpi/private.h"
14 #include <smpi/smpi.h>
15
16 #include "mc_state.h"
17
18 #ifndef MC_COMM_PATTERN_H
19 #define MC_COMM_PATTERN_H
20
21 SG_BEGIN_DECL()
22
23 typedef struct s_mc_comm_pattern{
24   int num;
25   smx_synchro_t comm;
26   e_smx_comm_type_t type;
27   unsigned long src_proc;
28   unsigned long dst_proc;
29   const char *src_host;
30   const char *dst_host;
31   char *rdv;
32   ssize_t data_size;
33   void *data;
34   int tag;
35   int index;
36 } s_mc_comm_pattern_t, *mc_comm_pattern_t;
37
38 typedef struct s_mc_list_comm_pattern{
39   unsigned int index_comm;
40   xbt_dynar_t list;
41 }s_mc_list_comm_pattern_t, *mc_list_comm_pattern_t;
42
43 extern xbt_dynar_t initial_communications_pattern;
44 extern xbt_dynar_t incomplete_communications_pattern;
45
46 typedef enum {
47   MC_CALL_TYPE_NONE,
48   MC_CALL_TYPE_SEND,
49   MC_CALL_TYPE_RECV,
50   MC_CALL_TYPE_WAIT,
51   MC_CALL_TYPE_WAITANY,
52 } e_mc_call_type_t;
53
54 typedef enum {
55   NONE_DIFF,
56   TYPE_DIFF,
57   RDV_DIFF,
58   TAG_DIFF,
59   SRC_PROC_DIFF,
60   DST_PROC_DIFF,
61   DATA_SIZE_DIFF,
62   DATA_DIFF,
63 } e_mc_comm_pattern_difference_t;
64
65 static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req)
66 {
67   switch(req->call) {
68   case SIMCALL_COMM_ISEND:
69     return MC_CALL_TYPE_SEND;
70   case SIMCALL_COMM_IRECV:
71     return MC_CALL_TYPE_RECV;
72   case SIMCALL_COMM_WAIT:
73     return MC_CALL_TYPE_WAIT;
74   case SIMCALL_COMM_WAITANY:
75     return MC_CALL_TYPE_WAITANY;
76   default:
77     return MC_CALL_TYPE_NONE;
78   }
79 }
80
81 void MC_get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, e_mc_call_type_t call_type, int backtracking);
82 void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern, int backtracking);
83 void MC_comm_pattern_free_voidp(void *p);
84 void MC_list_comm_pattern_free_voidp(void *p);
85 void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, unsigned int issuer, int backtracking);
86 void MC_pre_modelcheck_comm_determinism(void);
87 void MC_modelcheck_comm_determinism(void);
88
89 void MC_restore_communications_pattern(mc_state_t state);
90
91 mc_comm_pattern_t MC_comm_pattern_dup(mc_comm_pattern_t comm);
92 xbt_dynar_t MC_comm_patterns_dup(xbt_dynar_t state);
93
94 void MC_state_copy_incomplete_communications_pattern(mc_state_t state);
95 void MC_state_copy_index_communications_pattern(mc_state_t state);
96
97 void MC_comm_pattern_free(mc_comm_pattern_t p);
98
99 SG_END_DECL()
100
101 #endif