A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
mpi
model
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
32
#include "
parallel-communication-interface.h
"
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
56
class
SentBuffer
57
{
58
public
:
59
SentBuffer
();
60
~SentBuffer
();
61
65
uint8_t*
GetBuffer
();
69
void
SetBuffer
(uint8_t* buffer);
73
MPI_Request
*
GetRequest
();
74
75
private
:
76
uint8_t*
m_buffer
;
77
MPI_Request
m_request
;
78
};
79
80
class
Packet
;
81
91
class
GrantedTimeWindowMpiInterface
:
public
ParallelCommunicationInterface
,
Object
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
164
static
MPI_Request
*
m_requests
;
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 */
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:102
ns3::Ptr< Packet >
ns3::GrantedTimeWindowMpiInterface::GetRxCount
static uint32_t GetRxCount()
Definition:
granted-time-window-mpi-interface.cc:119
ns3::GrantedTimeWindowMpiInterface::m_pRxBuffers
static char ** m_pRxBuffers
Definition:
granted-time-window-mpi-interface.h:167
ns3::SentBuffer::~SentBuffer
~SentBuffer()
Definition:
granted-time-window-mpi-interface.cc:53
ns3::GrantedTimeWindowMpiInterface::m_enabled
static bool m_enabled
Definition:
granted-time-window-mpi-interface.h:161
ns3::GrantedTimeWindowMpiInterface::GetTypeId
static TypeId GetTypeId(void)
Definition:
granted-time-window-mpi-interface.cc:92
ns3::GrantedTimeWindowMpiInterface::GetTxCount
static uint32_t GetTxCount()
Definition:
granted-time-window-mpi-interface.cc:125
ns3::GrantedTimeWindowMpiInterface::Enable
virtual void Enable(int *pargc, char ***pargv)
Definition:
granted-time-window-mpi-interface.cc:164
ns3::GrantedTimeWindowMpiInterface::GetSize
virtual uint32_t GetSize()
Definition:
granted-time-window-mpi-interface.cc:142
ns3::ParallelCommunicationInterface
Pure virtual base class for the interface between ns-3 and the parallel communication layer being use...
Definition:
parallel-communication-interface.h:49
ns3::Packet
network packets
Definition:
packet.h:231
ns3::GrantedTimeWindowMpiInterface::TestSendComplete
static void TestSendComplete()
Check for completed sends.
Definition:
granted-time-window-mpi-interface.cc:290
ns3::GrantedTimeWindowMpiInterface::GetSystemId
virtual uint32_t GetSystemId()
Definition:
granted-time-window-mpi-interface.cc:131
ns3::GrantedTimeWindowMpiInterface::m_sid
static uint32_t m_sid
Definition:
granted-time-window-mpi-interface.h:152
ns3::SentBuffer::SentBuffer
SentBuffer()
Definition:
granted-time-window-mpi-interface.cc:47
ns3::GrantedTimeWindowMpiInterface::m_pendingTx
static std::list< SentBuffer > m_pendingTx
Definition:
granted-time-window-mpi-interface.h:170
ns3::SentBuffer::m_buffer
uint8_t * m_buffer
Definition:
granted-time-window-mpi-interface.h:76
ns3::GrantedTimeWindowMpiInterface
Interface between ns-3 and MPI.
Definition:
granted-time-window-mpi-interface.h:91
ns3::SentBuffer::SetBuffer
void SetBuffer(uint8_t *buffer)
Definition:
granted-time-window-mpi-interface.cc:65
ns3::SentBuffer::m_request
MPI_Request m_request
Definition:
granted-time-window-mpi-interface.h:77
ns3::SentBuffer
Tracks non-blocking sends.
Definition:
granted-time-window-mpi-interface.h:56
ns3::GrantedTimeWindowMpiInterface::IsEnabled
virtual bool IsEnabled()
Definition:
granted-time-window-mpi-interface.cc:153
ns3::SentBuffer::GetBuffer
uint8_t * GetBuffer()
Definition:
granted-time-window-mpi-interface.cc:59
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
parallel-communication-interface.h
ns3::GrantedTimeWindowMpiInterface::m_txCount
static uint32_t m_txCount
Definition:
granted-time-window-mpi-interface.h:159
ns3::GrantedTimeWindowMpiInterface::m_size
static uint32_t m_size
Definition:
granted-time-window-mpi-interface.h:153
ns3::GrantedTimeWindowMpiInterface::Disable
virtual void Disable()
Terminates the MPI environment by calling MPI_Finalize This function must be called after Destroy () ...
Definition:
granted-time-window-mpi-interface.cc:314
ns3::GrantedTimeWindowMpiInterface::SendPacket
virtual void SendPacket(Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)
Definition:
granted-time-window-mpi-interface.cc:191
ns3::GrantedTimeWindowMpiInterface::m_initialized
static bool m_initialized
Definition:
granted-time-window-mpi-interface.h:160
ns3::SentBuffer::GetRequest
MPI_Request * GetRequest()
ns3::GrantedTimeWindowMpiInterface::ReceiveMessages
static void ReceiveMessages()
Check for received messages complete.
Definition:
granted-time-window-mpi-interface.cc:226
ns3::MAX_MPI_MSG_SIZE
const uint32_t MAX_MPI_MSG_SIZE
maximum MPI message size for easy buffer creation
Definition:
granted-time-window-mpi-interface.h:46
MPI_Request
void * MPI_Request
Definition:
granted-time-window-mpi-interface.h:37
ns3::GrantedTimeWindowMpiInterface::m_rxCount
static uint32_t m_rxCount
Definition:
granted-time-window-mpi-interface.h:156
ns3::GrantedTimeWindowMpiInterface::m_requests
static MPI_Request * m_requests
Definition:
granted-time-window-mpi-interface.h:164
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:87
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::GrantedTimeWindowMpiInterface::Destroy
virtual void Destroy()
Delete all buffers.
Definition:
granted-time-window-mpi-interface.cc:102
Generated on Wed Nov 7 2018 10:02:06 for ns-3 by
1.8.14