Bridge++
Ver. 1.1.x
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
communicator_mpi.h
Go to the documentation of this file.
1
14
#ifndef COMMUNICATOR_MPI_INCLUDED
15
#define COMMUNICATOR_MPI_INCLUDED
16
17
#include <cstdarg>
18
#include <cstring>
19
#include <mpi.h>
20
#include <exception>
21
#include <cassert>
22
23
#include "
communicator.h
"
24
#include "
channel.h
"
25
27
34
class
Communicator_impl
{
35
public
:
36
static
int
init
(
int
*pargc,
char
***pargv);
37
static
int
finalize
();
38
static
void
abort
();
39
40
static
int
setup
(
int
ninstance = 1);
41
42
// info about rank
43
static
bool
is_primary
();
44
45
#ifdef ENABLE_MULTI_INSTANCE
46
static
bool
is_primary_master();
47
#endif
48
49
static
int
self
();
//< rank within small world.
50
static
int
size
();
//< size of small world.
51
52
#ifdef ENABLE_MULTI_INSTANCE
53
static
int
self_global();
54
static
int
world_id();
55
#endif
56
57
//XXX
58
static
MPI_Comm&
world
() {
return
m_comm
; }
59
60
#if 0
61
// layout
62
static
int
ipe(
const
int
dir);
//< logical coordinate of current proc.
63
static
int
npe(
const
int
dir);
//< logical grid extent
64
65
static
int
grid_rank(
int
*rank,
const
int
*grid_coord);
66
static
int
grid_coord(
int
*grid_coord,
const
int
rank);
67
static
int
grid_dims(
int
*grid_dims);
68
#endif
69
70
// synchronize
71
static
int
sync
();
//< synchronize within small world.
72
73
#ifdef ENABLE_MULTI_INSTANCE
74
static
int
sync_global();
//< synchronize all processes.
75
#endif
76
77
// info
78
static
double
get_time
();
79
80
// debug
81
static
int
status
();
82
83
// base case
84
class
Base
{
85
public
:
86
static
int
reduce
(
int
count,
void
*recv_buf,
void
*send_buf, MPI_Datatype type, MPI_Op op,
int
pattern);
87
static
int
broadcast
(
size_t
size,
void
*data,
int
sender);
88
static
int
exchange
(
size_t
size,
void
*recv_buf,
void
*send_buf,
int
idir,
int
ipm,
int
tag);
89
90
static
int
send_1to1
(
size_t
size,
void
*recv_buf,
void
*send_buf,
int
send_to,
int
recv_from,
int
tag);
91
};
92
93
// for specific datatypes
94
static
int
broadcast_string
(
int
count,
string
& data,
int
sender);
95
96
// async communication
97
static
Channel
*
send_init
(
int
count,
int
idir,
int
ipm);
98
static
Channel
*
recv_init
(
int
count,
int
idir,
int
ipm);
99
100
// logical and physical layout
101
class
Layout
;
102
103
private
:
104
105
Communicator_impl
() {}
106
Communicator_impl
(
const
Communicator_impl
&) {}
107
Communicator_impl
&
operator=
(
const
Communicator_impl
&);
108
109
~Communicator_impl
() {}
110
111
#ifdef ENABLE_MULTI_INSTANCE
112
static
int
m_n_instance;
// number of instances
113
static
int
m_instance_id;
// id of present instance
114
115
static
int
m_global_rank;
116
static
int
m_global_size;
117
#endif
118
119
static
int
m_grid_rank
;
120
static
int
m_grid_size
;
121
122
static
MPI_Comm
m_comm
;
123
};
124
#endif
/* m__COMMUNICATOR_MPI_H */
src
Communicator
MPI
communicator_mpi.h
Generated on Tue Jul 23 2013 10:48:48 for Bridge++ by
1.8.3.1