Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Better documentation of AddressSpace
[simgrid.git] / src / mc / mc_comm_pattern.h
1 /* Copyright (c) 2007-2015. 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 SIMGRID_MC_COMM_PATTERN_H
8 #define SIMGRID_MC_COMM_PATTERN_H
9
10 #include <cstddef>
11
12 #include <vector>
13
14 #include <simgrid_config.h>
15 #include <xbt/dynar.h>
16
17 #include "src/simix/smx_private.h"
18 #include "src/smpi/private.h"
19 #include <smpi/smpi.h>
20
21 #include "src/mc/mc_state.h"
22
23 namespace simgrid {
24 namespace mc {
25
26 struct PatternCommunicationList {
27   unsigned int index_comm = 0;
28   std::vector<std::unique_ptr<simgrid::mc::PatternCommunication>> list;
29 };
30
31 }
32 }
33
34 SG_BEGIN_DECL()
35
36 /**
37  *  Type: `xbt_dynar_t<mc_list_comm_pattern_t>`
38  */
39 extern XBT_PRIVATE xbt_dynar_t initial_communications_pattern;
40
41 /**
42  *  Type: `xbt_dynar_t<xbt_dynar_t<simgrid::mc::PatternCommunication*>>`
43  */
44 extern XBT_PRIVATE 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 XBT_PRIVATE 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);
82
83 XBT_PRIVATE void MC_restore_communications_pattern(simgrid::mc::State* state);
84
85 XBT_PRIVATE void MC_state_copy_incomplete_communications_pattern(simgrid::mc::State* state);
86 XBT_PRIVATE void MC_state_copy_index_communications_pattern(simgrid::mc::State* state);
87
88 SG_END_DECL()
89
90 #endif