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 */
src
mpi
model
mpi-interface.h
Generated on Tue Oct 9 2012 16:45:43 for ns-3 by
1.8.1.2