parallel_sim_helpers.hpp
Go to the documentation of this file.
1 /**********************************************************************
2  * parallel_sim_helpers.hpp -- Helper primitives for parallel simulation*
3  * *
4  * Author: Hosein Attarzadeh (shan2@kth.se) *
5  * *
6  * Purpose: Providing helper primitives for parallel simulations *
7  * *
8  * Usage: This file is included automatically *
9  * *
10  * License: BSD3 *
11  *******************************************************************/
12 
13 #ifndef PARALLEL_SIM_HPP
14 #define PARALLEL_SIM_HPP
15 
23 #include <mpi.h>
24 
25 #include "parallel_sim.hpp"
26 
27 
28 namespace ForSyDe
29 {
30 
31 namespace SY
32 {
33 
34 using namespace sc_core;
35 
37 
43 template <class T0, template <class> class I0If>
44 inline sender<T0>* make_sender(const std::string& pName,
45  int destination,
46  int tag,
47  I0If<T0>& inp1S
48  )
49 {
50  auto p = new sender<T0>(pName.c_str(), destination, tag);
51 
52  (*p).iport1(inp1S);
53 
54  return p;
55 }
56 
58 
64 template <class T0, template <class> class OIf>
65 inline receiver<T0>* make_receiver(const std::string& pName,
66  int source,
67  int tag,
68  OIf<T0>& outS
69  )
70 {
71  auto p = new receiver<T0>(pName.c_str(), source, tag);
72 
73  (*p).oport1(outS);
74 
75  return p;
76 }
77 
78 
79 }
80 }
81 
82 #endif
receiver< T0 > * make_receiver(const std::string &pName, int source, int tag, OIf< T0 > &outS)
Helper function to construct a sender process.
Definition: parallel_sim_helpers.hpp:65
The namespace for ForSyDe.
Definition: abssemantics.hpp:30
SY_in< T1 > iport1
port for the input channel
Definition: parallel_sim.hpp:43
Definition of sender and receiver processes.
Process constructor for a source process.
Definition: sy_process_constructors.hpp:1092
SY_out< T0 > oport1
port for the output channel
Definition: parallel_sim.hpp:122
Process constructor for a sender process with one input.
Definition: parallel_sim.hpp:40
Process constructor for a receiver process with one output.
Definition: parallel_sim.hpp:119
sender< T0 > * make_sender(const std::string &pName, int destination, int tag, I0If< T0 > &inp1S)
Helper function to construct a sender process.
Definition: parallel_sim_helpers.hpp:44