#include #include "MPIChannel.h" MPIChannel::MPIChannel(int dest, int tag, MPI_Comm comm) : Channel() { m_dest = dest; m_tag = tag; m_comm = comm; } MPIChannel::~MPIChannel() { } MPI_Comm MPIChannel::getMPIComm() { return m_comm; } int MPIChannel::getDest() { return m_dest; } int MPIChannel::getTag() { return m_tag; } int MPIChannel::read(void *buf, channel_datatype_t datatype, size_t count) { MPI_Status status; MPI_Recv(buf, count, datatype, m_dest, m_tag, MPI_COMM_WORLD, &status); return 0; } int MPIChannel::write(const void *buf, channel_datatype_t datatype, size_t count) { MPI_Send((void *) buf, count, datatype, m_dest, m_tag, MPI_COMM_WORLD); return 0; } int MPIChannel::available() { int flag; MPI_Status status; MPI_Iprobe(m_dest, m_tag, MPI_COMM_WORLD, &flag, &status); return flag; }