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 #include "mpi.h"
35 
36 namespace ns3 {
37 
42 const uint32_t MAX_MPI_MSG_SIZE = 2000;
43 
53 {
54 public:
55  SentBuffer ();
56  ~SentBuffer ();
57 
61  uint8_t* GetBuffer ();
65  void SetBuffer (uint8_t* buffer);
69  MPI_Request* GetRequest ();
70 
71 private:
72  uint8_t* m_buffer;
73  MPI_Request m_request;
74 };
75 
76 class Packet;
77 
88 {
89 public:
90  static TypeId GetTypeId (void);
91 
95  virtual void Destroy ();
99  virtual uint32_t GetSystemId ();
103  virtual uint32_t GetSize ();
107  virtual bool IsEnabled ();
114  virtual void Enable (int* pargc, char*** pargv);
120  virtual void Disable ();
129  virtual void SendPacket (Ptr<Packet> p, const Time &rxTime, uint32_t node, uint32_t dev);
133  static void ReceiveMessages ();
137  static void TestSendComplete ();
141  static uint32_t GetRxCount ();
145  static uint32_t GetTxCount ();
146 
147 private:
148  static uint32_t m_sid;
149  static uint32_t m_size;
150 
151  // Total packets received
152  static uint32_t m_rxCount;
153 
154  // Total packets sent
155  static uint32_t m_txCount;
156  static bool m_initialized;
157  static bool m_enabled;
158 
159  // Pending non-blocking receives
160  static MPI_Request* m_requests;
161 
162  // Data buffers for non-blocking reads
163  static char** m_pRxBuffers;
164 
165  // List of pending non-blocking sends
166  static std::list<SentBuffer> m_pendingTx;
167 };
168 
169 } // namespace ns3
170 
171 #endif /* NS3_GRANTED_TIME_WINDOW_MPI_INTERFACE_H */
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
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)
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