1 /* Copyright (c) 2007-2015. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef SIMGRID_MC_COMM_PATTERN_H
8 #define SIMGRID_MC_COMM_PATTERN_H
12 #include <simgrid_config.h>
13 #include <xbt/dynar.h>
15 #include "src/simix/smx_private.h"
16 #include "src/smpi/private.h"
17 #include <smpi/smpi.h>
19 #include "src/mc/mc_state.h"
23 typedef struct s_mc_comm_pattern{
25 smx_synchro_t comm_addr;
26 e_smx_comm_type_t type;
27 unsigned long src_proc;
28 unsigned long dst_proc;
36 } s_mc_comm_pattern_t, *mc_comm_pattern_t;
38 typedef struct s_mc_list_comm_pattern{
39 unsigned int index_comm;
41 }s_mc_list_comm_pattern_t, *mc_list_comm_pattern_t;
44 * Type: `xbt_dynar_t<mc_list_comm_pattenr_t>`
46 extern XBT_PRIVATE xbt_dynar_t initial_communications_pattern;
49 * Type: `xbt_dynar_t<xbt_dynar_t<mc_comm_pattern_t>>`
51 extern XBT_PRIVATE xbt_dynar_t incomplete_communications_pattern;
70 } e_mc_comm_pattern_difference_t;
72 static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req)
75 case SIMCALL_COMM_ISEND:
76 return MC_CALL_TYPE_SEND;
77 case SIMCALL_COMM_IRECV:
78 return MC_CALL_TYPE_RECV;
79 case SIMCALL_COMM_WAIT:
80 return MC_CALL_TYPE_WAIT;
81 case SIMCALL_COMM_WAITANY:
82 return MC_CALL_TYPE_WAITANY;
84 return MC_CALL_TYPE_NONE;
88 XBT_PRIVATE void MC_get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, e_mc_call_type_t call_type, int backtracking);
89 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);
90 XBT_PRIVATE void MC_comm_pattern_free_voidp(void *p);
91 XBT_PRIVATE void MC_list_comm_pattern_free_voidp(void *p);
92 XBT_PRIVATE void MC_complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm_addr, unsigned int issuer, int backtracking);
93 int MC_modelcheck_comm_determinism(void);
95 XBT_PRIVATE void MC_restore_communications_pattern(mc_state_t state);
97 XBT_PRIVATE mc_comm_pattern_t MC_comm_pattern_dup(mc_comm_pattern_t comm);
98 XBT_PRIVATE xbt_dynar_t MC_comm_patterns_dup(xbt_dynar_t state);
100 XBT_PRIVATE void MC_state_copy_incomplete_communications_pattern(mc_state_t state);
101 XBT_PRIVATE void MC_state_copy_index_communications_pattern(mc_state_t state);
103 XBT_PRIVATE void MC_comm_pattern_free(mc_comm_pattern_t p);