#include "MyMPI.hpp" #include "P2PComm.hpp" #include using std::cout; using std::endl; using namespace MF; int main(int argc, char* argv[]) { const MyMPI* mpi = MyMPI::instance(); const int master = 0; const unsigned int cntAlpha = 26 + 1; const unsigned int cntBlock = 7; const unsigned int lenBlock = 2; const unsigned int stride = 4; MPI::Datatype Alphabet = MPI::CHAR.Create_vector(cntBlock, lenBlock, stride); Alphabet.Commit(); if (mpi->rank() == master) //master { char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const int tag = 0; Transceiver<> transceiver; for (int dest=1; destsize(); ++dest) { transceiver.send(&alphabet, 1, Alphabet, dest, tag); } } else { const int from = master; const int tag = 0; MPI::Status status; Transceiver<> transceiver; char toRecv[cntAlpha]; transceiver.recv(&toRecv, 1, Alphabet, from, tag, status); toRecv[26] = '\0';//explicit termination cout << *mpi->instance() << " received: " << toRecv << endl; } Alphabet.Free(); return 0; }