Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Channel Class Reference

Channel class for asynchronous communication. More...

#include <channel.h>

Classes

struct  bgnet_IDs
 

Public Types

enum  channel_mode { SEND, RECV }
 
typedef char element_type
 
typedef std::vector< element_typecontainer_type
 
typedef char element_type
 data transfer is byte-wise. More...
 
typedef std::valarray
< element_type
container_type
 
typedef char element_type
 data transfer is byte-wise. More...
 

Public Member Functions

 Channel ()
 
 Channel (const int count)
 
 Channel (const int count, const int tag, const channel_mode mode)
 
virtual ~Channel ()
 
int start ()
 
int wait ()
 
void set_thread (int, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &)
 
int start_thread (int)
 
int wait_thread (int)
 
element_typeoperator[] (unsigned int idx)
 
const element_typeptr ()
 
const element_typeptr (int offset)
 
 Channel ()
 constructor. More...
 
 Channel (const int count)
 constructor with buffer size (count bytes) More...
 
virtual ~Channel ()
 destructor More...
 
int start ()
 start asynchronous communication More...
 
int wait ()
 wait for completion More...
 
element_typeoperator[] (unsigned int idx)
 accessor to buffer More...
 
element_type operator[] (unsigned int idx) const
 accessor to buffer More...
 
const element_typeptr ()
 accessor to buffer; returns pointer to the first element. More...
 
 Channel ()
 constructor. More...
 
 Channel (const int count)
 constructor with buffer size (count bytes) More...
 
 Channel (void *buf)
 constructor with buffer More...
 
virtual ~Channel ()
 destructor More...
 
int start ()
 start asynchronous communication More...
 
int wait ()
 wait for completion More...
 
element_typeoperator[] (unsigned int idx)
 accessor to buffer More...
 
element_type operator[] (unsigned int idx) const
 accessor to buffer More...
 
const element_typeptr ()
 accessor to buffer; returns pointer to the first element. More...
 

Static Public Member Functions

static void increment_channel_set_id ()
 To be called before defining new set of channels for a operator. More...
 

Private Attributes

int m_count
 
int m_ibuf
 
bgnet_IDs m_bgnet_ids
 
std::vector< bgnet_IDsm_bgnet_ids_thread
 
container_type m_buf
 buffer More...
 
MPI_Request m_request
 handler to MPI persistent communication More...
 
MPI_Status m_status
 handler to MPI status information More...
 
element_typem_buf
 buffer More...
 
bool m_my_buf
 whether buffer is owned by this instance. More...
 

Static Private Attributes

static std::vector
< container_type
m_buf
 
static int m_set_id = 0
 identifies set of channels. More...
 

Friends

class Communicator_impl
 
class ChannelSet
 
class Communicator
 

Detailed Description

Channel class for asynchronous communication.

Channel class defines communication channel between sender and receiver for asynchronous data transfer. It actually provides a half-channel of sender part or receiver part. This class wraps MPI persistent communication, as well as send/receive buffer.

An instance of channel class is generated through Communicator send_int() and recv_init() methods. To access the buffer, operator[] is provided as if it is an ordinary container or array.

start() method to start async data transfer, and wait() method to wait for the completion of operation. the channel instance will be re-used repeatedly for the same communication channel once it is created.

Channel class for single process. This implementation acts similarly to the Channel class with MPI, while practically copys data through the buffer.

Channel class defines communication channel between sender and receiver for asynchronous data transfer. It actually provides a half-channel of sender part or receiver part. Original version of Channel class wraps MPI persistent communication, as well as send/receive buffer.

An instance of channel class is generated through Communicator send_int() and recv_init() methods. To access the buffer, operator[] is provided as if it is an ordinary container or array.

In single process version, start() method copys data to buffer, and wait() method does nothing. [01 Sep 2017 H.Matsufuru]

Definition at line 24 of file channel.h.

Member Typedef Documentation

typedef std::vector<element_type> Channel::container_type

Definition at line 27 of file channel.h.

typedef std::valarray<element_type> Channel::container_type

Definition at line 51 of file channel.h.

typedef char Channel::element_type

Definition at line 26 of file channel.h.

typedef char Channel::element_type

data transfer is byte-wise.

Definition at line 50 of file channel.h.

typedef char Channel::element_type

data transfer is byte-wise.

Definition at line 51 of file channel.h.

Member Enumeration Documentation

Enumerator
SEND 
RECV 

Definition at line 28 of file channel.h.

Constructor & Destructor Documentation

Channel::Channel ( )

Definition at line 95 of file channel.cpp.

Channel::Channel ( const int  count)

Definition at line 101 of file channel.cpp.

Channel::Channel ( const int  count,
const int  tag,
const channel_mode  mode 
)

Definition at line 135 of file channel.cpp.

Channel::~Channel ( )
virtual

Definition at line 187 of file channel.cpp.

Channel::Channel ( )

constructor.

Channel::Channel ( const int  count)

constructor with buffer size (count bytes)

virtual Channel::~Channel ( )
virtual

destructor

Channel::Channel ( )

constructor.

Channel::Channel ( const int  count)

constructor with buffer size (count bytes)

Channel::Channel ( void *  buf)

constructor with buffer

Definition at line 92 of file channel.cpp.

virtual Channel::~Channel ( )
virtual

destructor

Member Function Documentation

static void Channel::increment_channel_set_id ( )
static

To be called before defining new set of channels for a operator.

element_type& Channel::operator[] ( unsigned int  idx)
inline

accessor to buffer

Definition at line 61 of file channel.h.

element_type& Channel::operator[] ( unsigned int  idx)
inline

accessor to buffer

Definition at line 62 of file channel.h.

element_type Channel::operator[] ( unsigned int  idx) const
inline

accessor to buffer

Definition at line 63 of file channel.h.

element_type Channel::operator[] ( unsigned int  idx) const
inline

accessor to buffer

Definition at line 64 of file channel.h.

element_type& Channel::operator[] ( unsigned int  idx)
inline

Definition at line 77 of file channel.h.

const element_type* Channel::ptr ( )
inline

accessor to buffer; returns pointer to the first element.

Definition at line 65 of file channel.h.

const element_type* Channel::ptr ( )
inline

accessor to buffer; returns pointer to the first element.

Definition at line 66 of file channel.h.

const element_type* Channel::ptr ( )
inline

Definition at line 84 of file channel.h.

const element_type* Channel::ptr ( int  offset)
inline

Definition at line 89 of file channel.h.

void Channel::set_thread ( int  Ntask,
const std::vector< int > &  destid,
const std::vector< int > &  offset,
const std::vector< int > &  datasize 
)

Definition at line 38 of file channel.cpp.

int Channel::start ( )

start asynchronous communication

int Channel::start ( )

start asynchronous communication

int Channel::start ( )

Definition at line 194 of file channel.cpp.

int Channel::start_thread ( int  itask)

Definition at line 236 of file channel.cpp.

int Channel::wait ( )

wait for completion

int Channel::wait ( )

wait for completion

int Channel::wait ( )

Definition at line 218 of file channel.cpp.

int Channel::wait_thread ( int  itask)

Definition at line 261 of file channel.cpp.

Friends And Related Function Documentation

ChannelSet
friend

Definition at line 74 of file channel.h.

friend class Communicator
friend

Definition at line 72 of file channel.h.

Definition at line 94 of file channel.h.

Member Data Documentation

bgnet_IDs Channel::m_bgnet_ids
private

Definition at line 54 of file channel.h.

std::vector<bgnet_IDs> Channel::m_bgnet_ids_thread
private

Definition at line 55 of file channel.h.

std::vector< Channel::container_type > Channel::m_buf
staticprivate

Definition at line 37 of file channel.h.

container_type Channel::m_buf
private

buffer

Definition at line 68 of file channel.h.

element_type* Channel::m_buf
private

buffer

Definition at line 69 of file channel.h.

int Channel::m_count
private

Definition at line 38 of file channel.h.

int Channel::m_ibuf
private

Definition at line 39 of file channel.h.

bool Channel::m_my_buf
private

whether buffer is owned by this instance.

Definition at line 70 of file channel.h.

MPI_Request Channel::m_request
private

handler to MPI persistent communication

Definition at line 70 of file channel.h.

int Channel::m_set_id = 0
staticprivate

identifies set of channels.

Definition at line 57 of file channel.h.

MPI_Status Channel::m_status
private

handler to MPI status information

Definition at line 71 of file channel.h.


The documentation for this class was generated from the following files: