Line data Source code
1 1 : /** 2 : * @file distributed/mpi.h 3 : * 4 : * @brief MPI Support Module 5 : * 6 : * This module implements all basic MPI facilities to let the distributed 7 : * execution of a simulation model take place consistently. 8 : * 9 : * Several facilities are thread-safe, others are not. Check carefully which 10 : * of these can be used by worker threads without coordination when relying 11 : * on this module. 12 : * 13 : * SPDX-FileCopyrightText: 2008-2021 HPDCS Group <rootsim@googlegroups.com> 14 : * SPDX-License-Identifier: GPL-3.0-only 15 : */ 16 : #pragma once 17 : 18 : #ifdef ROOTSIM_MPI 19 : 20 : #include <lp/msg.h> 21 : 22 : /// A control message MPI tag value 23 1 : enum msg_ctrl_tag { 24 : /// Used by the master to start a new gvt reduction operation 25 : MSG_CTRL_GVT_START = 1, 26 : /// Used by slaves to signal their completion of the gvt protocol 27 : MSG_CTRL_GVT_DONE, 28 : /// Used in broadcast to signal that local LPs can terminate 29 : MSG_CTRL_TERMINATION 30 : }; 31 : 32 1 : extern void mpi_global_init(int *argc_p, char ***argv_p); 33 1 : extern void mpi_global_fini(void); 34 : 35 1 : extern void mpi_remote_msg_send(struct lp_msg *msg, nid_t dest_nid); 36 1 : extern void mpi_remote_anti_msg_send(struct lp_msg *msg, nid_t dest_nid); 37 : 38 1 : extern void mpi_control_msg_broadcast(enum msg_ctrl_tag ctrl); 39 1 : extern void mpi_control_msg_send_to(enum msg_ctrl_tag ctrl, nid_t dest); 40 1 : extern void mpi_remote_msg_handle(void); 41 : 42 1 : extern void mpi_reduce_sum_scatter(const unsigned node_vals[n_nodes], unsigned *result); 43 1 : extern bool mpi_reduce_sum_scatter_done(void); 44 : 45 1 : extern void mpi_reduce_min(simtime_t *node_min_p); 46 1 : extern bool mpi_reduce_min_done(void); 47 : 48 1 : extern void mpi_node_barrier(void); 49 1 : extern void mpi_blocking_data_send(const void *data, int data_size, nid_t dest); 50 1 : extern void *mpi_blocking_data_rcv(int *data_size_p, nid_t src); 51 : 52 : #endif