A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
parallel-communication-interface.h
Go to the documentation of this file.
1/*
2 * Copyright 2013. Lawrence Livermore National Security, LLC.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Steven Smith <smith84@llnl.gov>
18 *
19 */
20
21/**
22 * \file
23 * \ingroup mpi
24 * Declaration of class ns3::ParallelCommunicationInterface.
25 */
26
27#ifndef NS3_PARALLEL_COMMUNICATION_INTERFACE_H
28#define NS3_PARALLEL_COMMUNICATION_INTERFACE_H
29
30#include <ns3/buffer.h>
31#include <ns3/nstime.h>
32#include <ns3/object.h>
33#include <ns3/packet.h>
34
35#include <list>
36#include <mpi.h>
37#include <stdint.h>
38
39namespace ns3
40{
41
42/**
43 * \ingroup mpi
44 *
45 * \brief Pure virtual base class for the interface between ns-3 and
46 * the parallel communication layer being used.
47 *
48 * This class is implemented for each of the parallel versions of
49 * SimulatorImpl to manage communication between process (ranks).
50 *
51 * This interface is called through the singleton MpiInterface class.
52 * MpiInterface has the same API as ParallelCommunicationInterface but
53 * being a singleton uses static methods to delegate to methods
54 * defined in classes that implement the
55 * ParallelCommunicationInterface. For example, SendPacket is likely
56 * to be specialized for a specific parallel SimulatorImpl.
57 */
59{
60 public:
61 /**
62 * Destructor
63 */
65 {
66 }
67
68 /**
69 * \copydoc MpiInterface::Destroy
70 */
71 virtual void Destroy() = 0;
72 /**
73 * \copydoc MpiInterface::GetSystemId
74 */
75 virtual uint32_t GetSystemId() = 0;
76 /**
77 * \copydoc MpiInterface::GetSize
78 */
79 virtual uint32_t GetSize() = 0;
80 /**
81 * \copydoc MpiInterface::IsEnabled
82 */
83 virtual bool IsEnabled() = 0;
84 /**
85 * \copydoc MpiInterface::Enable(int* pargc,char*** pargv)
86 */
87 virtual void Enable(int* pargc, char*** pargv) = 0;
88 /**
89 * \copydoc MpiInterface::Enable(MPI_Comm communicator)
90 */
91 virtual void Enable(MPI_Comm communicator) = 0;
92 /**
93 * \copydoc MpiInterface::Disable
94 */
95 virtual void Disable() = 0;
96 /**
97 * \copydoc MpiInterface::SendPacket
98 */
99 virtual void SendPacket(Ptr<Packet> p, const Time& rxTime, uint32_t node, uint32_t dev) = 0;
100 /**
101 * \copydoc MpiInterface::GetCommunicator
102 */
103 virtual MPI_Comm GetCommunicator() = 0;
104
105 private:
106};
107
108} // namespace ns3
109
110#endif /* NS3_PARALLEL_COMMUNICATION_INTERFACE_H */
Pure virtual base class for the interface between ns-3 and the parallel communication layer being use...
virtual void SendPacket(Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)=0
Send a packet to a remote node.
virtual void Enable(int *pargc, char ***pargv)=0
Setup the parallel communication interface.
virtual void Enable(MPI_Comm communicator)=0
Setup the parallel communication interface using the specified communicator.
virtual bool IsEnabled()=0
Returns enabled state of parallel environment.
virtual MPI_Comm GetCommunicator()=0
Return the communicator used to run ns-3.
virtual uint32_t GetSystemId()=0
Get the id number of this rank.
virtual void Destroy()=0
Deletes storage used by the parallel environment.
virtual uint32_t GetSize()=0
Get the number of ranks used by ns-3.
virtual void Disable()=0
Clean up the ns-3 parallel communications interface.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Every class exported by the ns3 library is enclosed in the ns3 namespace.