Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Enum class for MC call types, and MC comm pattern differences.
[simgrid.git] / src / mc / mc_comm_pattern.hpp
1 /* Copyright (c) 2007-2020. 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 SIMGRID_MC_COMM_PATTERN_H
7 #define SIMGRID_MC_COMM_PATTERN_H
8
9 #include <vector>
10
11 #include "smpi/smpi.h"
12 #include "src/mc/mc_state.hpp"
13
14 namespace simgrid {
15 namespace mc {
16
17 enum class CallType {
18   NONE,
19   SEND,
20   RECV,
21   WAIT,
22   WAITANY,
23 };
24
25 enum class CommPatternDifference {
26   NONE,
27   TYPE,
28   RDV,
29   TAG,
30   SRC_PROC,
31   DST_PROC,
32   DATA_SIZE,
33   DATA,
34 };
35
36 struct PatternCommunicationList {
37   unsigned int index_comm = 0;
38   std::vector<std::unique_ptr<simgrid::mc::PatternCommunication>> list;
39 };
40 } // namespace mc
41 } // namespace simgrid
42
43 extern XBT_PRIVATE std::vector<simgrid::mc::PatternCommunicationList> initial_communications_pattern;
44 extern XBT_PRIVATE std::vector<std::vector<simgrid::mc::PatternCommunication*>> incomplete_communications_pattern;
45
46 static inline simgrid::mc::CallType MC_get_call_type(const s_smx_simcall* req)
47 {
48   using simgrid::mc::CallType;
49   switch (req->call_) {
50     case SIMCALL_COMM_ISEND:
51       return CallType::SEND;
52     case SIMCALL_COMM_IRECV:
53       return CallType::RECV;
54     case SIMCALL_COMM_WAIT:
55       return CallType::WAIT;
56     case SIMCALL_COMM_WAITANY:
57       return CallType::WAITANY;
58     default:
59       return CallType::NONE;
60   }
61 }
62
63 XBT_PRIVATE void MC_handle_comm_pattern(simgrid::mc::CallType call_type, smx_simcall_t request, int value,
64                                         int backtracking);
65
66 XBT_PRIVATE void MC_restore_communications_pattern(simgrid::mc::State* state);
67
68 XBT_PRIVATE void MC_state_copy_incomplete_communications_pattern(simgrid::mc::State* state);
69 XBT_PRIVATE void MC_state_copy_index_communications_pattern(simgrid::mc::State* state);
70
71 #endif