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
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
// This object contains static methods that provide an easy interface
20
// to the necessary MPI information.
21
22
#ifndef NS3_MPI_INTERFACE_H
23
#define NS3_MPI_INTERFACE_H
24
25
#include <stdint.h>
26
#include <list>
27
28
#include "ns3/nstime.h"
29
#include "ns3/buffer.h"
30
31
#if defined(NS3_OPENMPI)
32
struct
ompi_request_t;
33
typedef
struct
ompi_request_t*
MPI_Request
;
34
#elif defined(NS3_MPICH)
35
typedef
int
MPI_Request
;
36
#else
37
typedef
void
*
MPI_Request
;
38
#endif
39
40
namespace
ns3 {
41
51
const
uint32_t
MAX_MPI_MSG_SIZE
= 2000;
52
58
class
SentBuffer
59
{
60
public
:
61
SentBuffer
();
62
~SentBuffer
();
63
67
uint8_t*
GetBuffer
();
71
void
SetBuffer
(uint8_t* buffer);
75
MPI_Request
*
GetRequest
();
76
77
private
:
78
uint8_t*
m_buffer
;
79
MPI_Request
m_request
;
80
};
81
82
class
Packet
;
83
89
class
MpiInterface
90
{
91
public
:
95
static
void
Destroy
();
99
static
uint32_t
GetSystemId
();
103
static
uint32_t
GetSize
();
107
static
bool
IsEnabled
();
114
static
void
Enable
(
int
* pargc,
char
*** pargv);
120
static
void
Disable
();
129
static
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_MPI_INTERFACE_H */
ns3::Time
keep track of time values and allow control of global simulation resolution
Definition:
nstime.h:81
ns3::Ptr< Packet >
ns3::MpiInterface::m_initialized
static bool m_initialized
Definition:
mpi-interface.h:156
ns3::MpiInterface
Definition:
mpi-interface.h:89
ns3::SentBuffer::~SentBuffer
~SentBuffer()
Definition:
mpi-interface.cc:48
ns3::MpiInterface::Disable
static void Disable()
Definition:
mpi-interface.cc:288
ns3::Packet
network packets
Definition:
packet.h:203
ns3::MpiInterface::m_pRxBuffers
static char ** m_pRxBuffers
Definition:
mpi-interface.h:163
ns3::MpiInterface::GetTxCount
static uint32_t GetTxCount()
Definition:
mpi-interface.cc:108
ns3::SentBuffer::SentBuffer
SentBuffer()
Definition:
mpi-interface.cc:42
ns3::MpiInterface::Destroy
static void Destroy()
Definition:
mpi-interface.cc:87
ns3::MpiInterface::Enable
static void Enable(int *pargc, char ***pargv)
Definition:
mpi-interface.cc:147
ns3::MpiInterface::IsEnabled
static bool IsEnabled()
Definition:
mpi-interface.cc:136
ns3::SentBuffer::m_buffer
uint8_t * m_buffer
Definition:
mpi-interface.h:78
ns3::MpiInterface::m_rxCount
static uint32_t m_rxCount
Definition:
mpi-interface.h:152
ns3::SentBuffer::SetBuffer
void SetBuffer(uint8_t *buffer)
Definition:
mpi-interface.cc:60
ns3::MpiInterface::GetRxCount
static uint32_t GetRxCount()
Definition:
mpi-interface.cc:102
ns3::SentBuffer::m_request
MPI_Request m_request
Definition:
mpi-interface.h:79
ns3::SentBuffer
Definition:
mpi-interface.h:58
ns3::SentBuffer::GetBuffer
uint8_t * GetBuffer()
Definition:
mpi-interface.cc:54
ns3::MpiInterface::ReceiveMessages
static void ReceiveMessages()
Definition:
mpi-interface.cc:205
ns3::MpiInterface::TestSendComplete
static void TestSendComplete()
Definition:
mpi-interface.cc:266
ns3::MpiInterface::m_enabled
static bool m_enabled
Definition:
mpi-interface.h:157
ns3::SentBuffer::GetRequest
MPI_Request * GetRequest()
ns3::MpiInterface::SendPacket
static void SendPacket(Ptr< Packet > p, const Time &rxTime, uint32_t node, uint32_t dev)
Definition:
mpi-interface.cc:172
ns3::MpiInterface::GetSystemId
static uint32_t GetSystemId()
Definition:
mpi-interface.cc:114
ns3::MpiInterface::m_size
static uint32_t m_size
Definition:
mpi-interface.h:149
ns3::MAX_MPI_MSG_SIZE
const uint32_t MAX_MPI_MSG_SIZE
Definition:
mpi-interface.h:51
ns3::MpiInterface::m_pendingTx
static std::list< SentBuffer > m_pendingTx
Definition:
mpi-interface.h:166
ns3::MpiInterface::m_sid
static uint32_t m_sid
Definition:
mpi-interface.h:148
ns3::MpiInterface::m_txCount
static uint32_t m_txCount
Definition:
mpi-interface.h:155
ns3::MpiInterface::GetSize
static uint32_t GetSize()
Definition:
mpi-interface.cc:125
ns3::MpiInterface::m_requests
static MPI_Request * m_requests
Definition:
mpi-interface.h:160
MPI_Request
void * MPI_Request
Definition:
mpi-interface.h:37
src
mpi
model
mpi-interface.h
Generated on Sat Nov 16 2013 16:17:48 for ns-3 by
1.8.5