A Discrete-Event Network Simulator
API
granted-time-window-mpi-interface.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Author: George Riley <riley@ece.gatech.edu>
17  *
18  */
19 
20 // This object contains static methods that provide an easy interface
21 // to the necessary MPI information.
22 
23 #ifndef NS3_GRANTED_TIME_WINDOW_MPI_INTERFACE_H
24 #define NS3_GRANTED_TIME_WINDOW_MPI_INTERFACE_H
25 
26 #include <stdint.h>
27 #include <list>
28 
29 #include "ns3/nstime.h"
30 #include "ns3/buffer.h"
31 
33 
34 #ifdef NS3_MPI
35 #include "mpi.h"
36 #else
37 typedef void* MPI_Request;
38 #endif
39 
40 namespace ns3 {
41 
46 const uint32_t MAX_MPI_MSG_SIZE = 2000;
47 
57 {
58 public:
59  SentBuffer ();
60  ~SentBuffer ();
61 
65  uint8_t* GetBuffer ();
69  void SetBuffer (uint8_t* buffer);
74 
75 private:
76  uint8_t* m_buffer;
78 };
79 
80 class Packet;
81 
92 {
93 public:
94  static TypeId GetTypeId (void);
95 
99  virtual void Destroy ();
103  virtual uint32_t GetSystemId ();
107  virtual uint32_t GetSize ();
111  virtual bool IsEnabled ();
118  virtual void Enable (int* pargc, char*** pargv);
124  virtual void Disable ();
133  virtual void SendPacket (Ptr<Packet> p, const Time &rxTime, uint32_t node, uint32_t dev);
137  static void ReceiveMessages ();
141  static void TestSendComplete ();
145  static uint32_t GetRxCount ();
149  static uint32_t GetTxCount ();
150 
151 private:
152  static uint32_t m_sid;
153  static uint32_t m_size;
154 
155  // Total packets received
156  static uint32_t m_rxCount;
157 
158  // Total packets sent
159  static uint32_t m_txCount;
160  static bool m_initialized;
161  static bool m_enabled;
162 
163  // Pending non-blocking receives
165 
166  // Data buffers for non-blocking reads
167  static char** m_pRxBuffers;
168 
169  // List of pending non-blocking sends
170  static std::list<SentBuffer> m_pendingTx;
171 };
172 
173 } // namespace ns3
174 
175 #endif /* NS3_GRANTED_TIME_WINDOW_MPI_INTERFACE_H */
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
virtual void Enable(int *pargc, char ***pargv)
Pure virtual base class for the interface between ns-3 and the parallel communication layer being use...
network packets
Definition: packet.h:231
static void TestSendComplete()
Check for completed sends.
Tracks non-blocking sends.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void Disable()
Terminates the MPI environment by calling MPI_Finalize This function must be called after Destroy () ...
virtual void SendPacket(Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)
MPI_Request * GetRequest()
static void ReceiveMessages()
Check for received messages complete.
const uint32_t MAX_MPI_MSG_SIZE
maximum MPI message size for easy buffer creation
A base class which provides memory management and object aggregation.
Definition: object.h:87
a unique identifier for an interface.
Definition: type-id.h:58