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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Steven Smith <smith84@llnl.gov>
7 *
8 */
9
10/**
11 * \file
12 * \ingroup mpi
13 * Declaration of class ns3::ParallelCommunicationInterface.
14 */
15
16#ifndef NS3_PARALLEL_COMMUNICATION_INTERFACE_H
17#define NS3_PARALLEL_COMMUNICATION_INTERFACE_H
18
19#include <ns3/buffer.h>
20#include <ns3/nstime.h>
21#include <ns3/object.h>
22#include <ns3/packet.h>
23
24#include <list>
25#include <mpi.h>
26#include <stdint.h>
27
28namespace ns3
29{
30
31/**
32 * \ingroup mpi
33 *
34 * \brief Pure virtual base class for the interface between ns-3 and
35 * the parallel communication layer being used.
36 *
37 * This class is implemented for each of the parallel versions of
38 * SimulatorImpl to manage communication between process (ranks).
39 *
40 * This interface is called through the singleton MpiInterface class.
41 * MpiInterface has the same API as ParallelCommunicationInterface but
42 * being a singleton uses static methods to delegate to methods
43 * defined in classes that implement the
44 * ParallelCommunicationInterface. For example, SendPacket is likely
45 * to be specialized for a specific parallel SimulatorImpl.
46 */
48{
49 public:
50 /**
51 * Destructor
52 */
56
57 /**
58 * \copydoc MpiInterface::Destroy
59 */
60 virtual void Destroy() = 0;
61 /**
62 * \copydoc MpiInterface::GetSystemId
63 */
64 virtual uint32_t GetSystemId() = 0;
65 /**
66 * \copydoc MpiInterface::GetSize
67 */
68 virtual uint32_t GetSize() = 0;
69 /**
70 * \copydoc MpiInterface::IsEnabled
71 */
72 virtual bool IsEnabled() = 0;
73 /**
74 * \copydoc MpiInterface::Enable(int* pargc,char*** pargv)
75 */
76 virtual void Enable(int* pargc, char*** pargv) = 0;
77 /**
78 * \copydoc MpiInterface::Enable(MPI_Comm communicator)
79 */
80 virtual void Enable(MPI_Comm communicator) = 0;
81 /**
82 * \copydoc MpiInterface::Disable
83 */
84 virtual void Disable() = 0;
85 /**
86 * \copydoc MpiInterface::SendPacket
87 */
88 virtual void SendPacket(Ptr<Packet> p, const Time& rxTime, uint32_t node, uint32_t dev) = 0;
89 /**
90 * \copydoc MpiInterface::GetCommunicator
91 */
92 virtual MPI_Comm GetCommunicator() = 0;
93
94 private:
95};
96
97} // namespace ns3
98
99#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.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Every class exported by the ns3 library is enclosed in the ns3 namespace.