source: proiecte/SIMEO/Simeo/src/SimeoEngine/MPIChannel.cpp @ 167

Last change on this file since 167 was 167, checked in by (none), 14 years ago

Simeo: added final project and also older proof of concept code.

We used Git for version control, so look at the Git repo
in SIMEO/Simeo/ for more info.

File size: 837 bytes
Line 
1#include <stdio.h>
2#include "MPIChannel.h"
3
4
5MPIChannel::MPIChannel(int dest, int tag, MPI_Comm comm)
6: Channel()
7{
8        m_dest = dest;
9        m_tag = tag;
10        m_comm = comm;
11}
12
13MPIChannel::~MPIChannel()
14{
15}
16
17MPI_Comm MPIChannel::getMPIComm()
18{
19        return m_comm;
20}
21
22int MPIChannel::getDest()
23{
24        return m_dest;
25}
26
27int MPIChannel::getTag()
28{
29        return m_tag;
30}
31
32int MPIChannel::read(void *buf, channel_datatype_t datatype, size_t count)
33{
34        MPI_Status status;
35        MPI_Recv(buf, count, datatype, m_dest, m_tag, MPI_COMM_WORLD, &status);
36        return 0;
37}
38
39int MPIChannel::write(const void *buf, channel_datatype_t datatype, size_t count)
40{
41        MPI_Send((void *) buf, count, datatype, m_dest, m_tag, MPI_COMM_WORLD);
42        return 0;
43}
44
45int MPIChannel::available()
46{
47        int flag;
48        MPI_Status status;
49
50        MPI_Iprobe(m_dest, m_tag, MPI_COMM_WORLD, &flag, &status);
51
52        return flag;
53}
Note: See TracBrowser for help on using the repository browser.