A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
null-message-mpi-interface.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright 2013. Lawrence Livermore National Security, LLC.
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Steven Smith <smith84@llnl.gov>
19
*
20
*/
21
22
#ifndef NS3_NULLMESSAGE_MPI_INTERFACE_H
23
#define NS3_NULLMESSAGE_MPI_INTERFACE_H
24
25
#include "
parallel-communication-interface.h
"
26
27
#include <ns3/nstime.h>
28
#include <ns3/buffer.h>
29
30
#ifdef NS3_MPI
31
#include "mpi.h"
32
#else
33
typedef
void
*
MPI_Request
;
34
#endif
35
36
#include <list>
37
38
namespace
ns3 {
39
40
class
RemoteChannelBundle;
41
class
Packet;
42
50
class
NullMessageSentBuffer
51
{
52
public
:
53
NullMessageSentBuffer
();
54
~NullMessageSentBuffer
();
55
59
uint8_t*
GetBuffer
();
63
void
SetBuffer
(uint8_t* buffer);
67
MPI_Request
*
GetRequest
();
68
69
private
:
70
74
uint8_t*
m_buffer
;
75
79
MPI_Request
m_request
;
80
};
81
88
class
NullMessageMpiInterface
:
public
ParallelCommunicationInterface
89
{
90
public
:
91
92
NullMessageMpiInterface
();
93
~NullMessageMpiInterface
();
94
98
virtual
void
Destroy
();
102
virtual
uint32_t
GetSystemId
();
106
virtual
uint32_t
GetSize
();
110
virtual
bool
IsEnabled
();
118
virtual
void
Enable
(
int
* pargc,
char
*** pargv);
124
virtual
void
Disable
();
143
virtual
void
SendPacket
(
Ptr<Packet>
p,
const
Time
&rxTime, uint32_t node, uint32_t dev);
169
static
void
SendNullMessage
(
const
Time
& guaranteeUpdate,
Ptr<RemoteChannelBundle>
bundle);
174
static
void
ReceiveMessagesNonBlocking
();
179
static
void
ReceiveMessagesBlocking
();
183
static
void
TestSendComplete
();
184
191
static
void
InitializeSendReceiveBuffers
(
void
);
192
193
private
:
194
202
static
void
ReceiveMessages
(
bool
blocking =
false
);
203
204
// System ID (rank) for this task
205
static
uint32_t
g_sid
;
206
207
// Size of the MPI COM_WORLD group.
208
static
uint32_t
g_size
;
209
210
// Number of neighbor tasks, tasks that this task shares a link with.
211
static
uint32_t
g_numNeighbors
;
212
213
static
bool
g_initialized
;
214
static
bool
g_enabled
;
215
216
// Pending non-blocking receives
217
static
MPI_Request
*
g_requests
;
218
219
// Data buffers for non-blocking receives
220
static
char
**
g_pRxBuffers
;
221
222
// List of pending non-blocking sends
223
static
std::list<NullMessageSentBuffer>
g_pendingTx
;
224
};
225
226
}
// namespace ns3
227
228
#endif
/* NS3_NULL_MESSAGE_MPI_INTERFACE_H */
ns3::NullMessageMpiInterface::Destroy
virtual void Destroy()
Delete all buffers.
Definition:
null-message-mpi-interface.cc:113
ns3::NullMessageMpiInterface::g_requests
static MPI_Request * g_requests
Definition:
null-message-mpi-interface.h:217
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::Ptr< Packet >
ns3::NullMessageSentBuffer::GetRequest
MPI_Request * GetRequest()
Definition:
null-message-mpi-interface.cc:79
ns3::NullMessageMpiInterface::~NullMessageMpiInterface
~NullMessageMpiInterface()
Definition:
null-message-mpi-interface.cc:107
ns3::NullMessageMpiInterface::GetSystemId
virtual uint32_t GetSystemId()
Definition:
null-message-mpi-interface.cc:119
ns3::NullMessageMpiInterface::ReceiveMessagesNonBlocking
static void ReceiveMessagesNonBlocking()
Non-blocking check for received messages complete.
Definition:
null-message-mpi-interface.cc:280
ns3::NullMessageSentBuffer::GetBuffer
uint8_t * GetBuffer()
Definition:
null-message-mpi-interface.cc:67
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::NullMessageSentBuffer::SetBuffer
void SetBuffer(uint8_t *buffer)
Definition:
null-message-mpi-interface.cc:73
ns3::NullMessageMpiInterface::SendPacket
virtual void SendPacket(Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)
Definition:
null-message-mpi-interface.cc:196
ns3::NullMessageMpiInterface::TestSendComplete
static void TestSendComplete()
Check for completed sends.
Definition:
null-message-mpi-interface.cc:390
ns3::NullMessageMpiInterface::GetSize
virtual uint32_t GetSize()
Definition:
null-message-mpi-interface.cc:126
ns3::NullMessageMpiInterface::Enable
virtual void Enable(int *pargc, char ***pargv)
Definition:
null-message-mpi-interface.cc:144
ns3::NullMessageMpiInterface::SendNullMessage
static void SendNullMessage(const Time &guaranteeUpdate, Ptr< RemoteChannelBundle > bundle)
Send a Null Message to across the specified bundle.
Definition:
null-message-mpi-interface.cc:239
ns3::NullMessageMpiInterface::ReceiveMessages
static void ReceiveMessages(bool blocking=false)
Check for received messages complete.
Definition:
null-message-mpi-interface.cc:289
ns3::NullMessageMpiInterface::Disable
virtual void Disable()
Terminates the MPI environment by calling MPI_Finalize This function must be called after Destroy ()...
Definition:
null-message-mpi-interface.cc:414
MPI_Request
void * MPI_Request
Definition:
null-message-mpi-interface.h:33
ns3::NullMessageMpiInterface::ReceiveMessagesBlocking
static void ReceiveMessagesBlocking()
Blocking message receive.
Definition:
null-message-mpi-interface.cc:271
ns3::NullMessageMpiInterface::IsEnabled
virtual bool IsEnabled()
Definition:
null-message-mpi-interface.cc:133
parallel-communication-interface.h
ns3::NullMessageSentBuffer::NullMessageSentBuffer
NullMessageSentBuffer()
Definition:
null-message-mpi-interface.cc:55
ns3::NullMessageMpiInterface::g_enabled
static bool g_enabled
Definition:
null-message-mpi-interface.h:214
ns3::NullMessageSentBuffer::m_buffer
uint8_t * m_buffer
Buffer for send.
Definition:
null-message-mpi-interface.h:74
ns3::NullMessageMpiInterface::g_initialized
static bool g_initialized
Definition:
null-message-mpi-interface.h:213
ns3::NullMessageSentBuffer::~NullMessageSentBuffer
~NullMessageSentBuffer()
Definition:
null-message-mpi-interface.cc:61
ns3::NullMessageMpiInterface::g_size
static uint32_t g_size
Definition:
null-message-mpi-interface.h:208
ns3::NullMessageSentBuffer
Non-blocking send buffers for Null Message implementation.
Definition:
null-message-mpi-interface.h:50
MPI_Request
void * MPI_Request
Definition:
granted-time-window-mpi-interface.h:37
ns3::NullMessageMpiInterface::g_pRxBuffers
static char ** g_pRxBuffers
Definition:
null-message-mpi-interface.h:220
ns3::NullMessageMpiInterface::InitializeSendReceiveBuffers
static void InitializeSendReceiveBuffers(void)
Initialize send and receive buffers.
Definition:
null-message-mpi-interface.cc:169
ns3::NullMessageMpiInterface::g_sid
static uint32_t g_sid
Definition:
null-message-mpi-interface.h:205
ns3::NullMessageMpiInterface::g_numNeighbors
static uint32_t g_numNeighbors
Definition:
null-message-mpi-interface.h:211
ns3::NullMessageMpiInterface::g_pendingTx
static std::list< NullMessageSentBuffer > g_pendingTx
Definition:
null-message-mpi-interface.h:223
ns3::NullMessageMpiInterface::NullMessageMpiInterface
NullMessageMpiInterface()
Definition:
null-message-mpi-interface.cc:94
ns3::NullMessageSentBuffer::m_request
MPI_Request m_request
MPI request posted for the send.
Definition:
null-message-mpi-interface.h:79
ns3::NullMessageMpiInterface
Interface between ns-3 and MPI for the Null Message distributed simulation implementation.
Definition:
null-message-mpi-interface.h:88
src
mpi
model
null-message-mpi-interface.h
Generated on Sat Apr 19 2014 14:07:04 for ns-3 by
1.8.6