The ROme OpTimistic Simulator  2.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
mpi.h
Go to the documentation of this file.
1 
29 #pragma once
30 
31 #ifdef HAVE_MPI
32 
33 #include <stdbool.h>
34 #include <mpi.h>
35 
36 #include <core/core.h>
37 #include <communication/wnd.h>
38 #include <statistics/statistics.h>
39 
41 #define lock_mpi() {if(!mpi_support_multithread) spin_lock(&mpi_lock);}
42 
44 #define unlock_mpi() {if(!mpi_support_multithread) spin_unlock(&mpi_lock);}
45 
46 extern bool mpi_support_multithread;
47 extern spinlock_t mpi_lock;
48 
49 void mpi_init(int *argc, char ***argv);
50 void inter_kernel_comm_init(void);
52 void mpi_finalize(void);
53 void syncronize_all(void);
54 void send_remote_msg(msg_t * msg);
55 bool pending_msgs(int tag);
56 void receive_remote_msgs(void);
57 bool is_request_completed(MPI_Request *);
58 bool all_kernels_terminated(void);
59 void broadcast_termination(void);
60 void collect_termination(void);
61 void mpi_reduce_statistics(struct stat_t *, struct stat_t *);
62 
63 #endif /* HAVE_MPI */
void syncronize_all(void)
Syncronize all the kernels.
Definition: mpi.c:492
Core ROOT-Sim functionalities.
void mpi_reduce_statistics(struct stat_t *, struct stat_t *)
Invoke statistics reduction.
Definition: mpi.c:428
void inter_kernel_comm_init(void)
Initialize inter-kernel communication.
Definition: mpi.c:545
void send_remote_msg(msg_t *msg)
Send a message to a remote LP.
Definition: mpi.c:169
void inter_kernel_comm_finalize(void)
Finalize inter-kernel communication.
Definition: mpi.c:562
Statistics module.
bool all_kernels_terminated(void)
Check if all kernels have reached the termination condition.
Definition: mpi.c:270
void mpi_finalize(void)
Finalize MPI.
Definition: mpi.c:578
Message Type definition.
Definition: core.h:164
void collect_termination(void)
Check if other kernels have reached the termination condition.
Definition: mpi.c:289
bool mpi_support_multithread
Flag telling whether the MPI runtime supports multithreading.
Definition: mpi.c:48
MPI Support Module.
bool is_request_completed(MPI_Request *)
check if an MPI request has been completed
Definition: mpi.c:144
spinlock_t mpi_lock
Definition: mpi.c:55
bool pending_msgs(int tag)
Check if there are pending messages.
Definition: mpi.c:122
void mpi_init(int *argc, char ***argv)
Initialize MPI subsystem.
Definition: mpi.c:514
void receive_remote_msgs(void)
Receive remote messages.
Definition: mpi.c:208
Message delivery support.
void broadcast_termination(void)
Notify all the kernels about local termination.
Definition: mpi.c:327