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
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
mpi-interface.h
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 unit.
Definition:
nstime.h:149
ns3::Ptr< Packet >
ns3::MpiInterface
Definition:
mpi-interface.h:89
ns3::MpiInterface::Disable
static void Disable()
Definition:
mpi-interface.cc:288
ns3::Packet
network packets
Definition:
packet.h:203
ns3::MpiInterface::GetTxCount
static uint32_t GetTxCount()
Definition:
mpi-interface.cc:108
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::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
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::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::MAX_MPI_MSG_SIZE
const uint32_t MAX_MPI_MSG_SIZE
Definition:
mpi-interface.h:51
ns3::MpiInterface::GetSize
static uint32_t GetSize()
Definition:
mpi-interface.cc:125
src
mpi
model
mpi-interface.h
Generated on Sun Mar 16 2014 11:25:08 for ns-3 by
1.8.6