I am new with c++ and trying to send a bool datatype through MPI, but c++ does not support this data type.
I tried to make it MPI_BYTE
and MPI_INT
but it prints nothing.
#include <iostream>
#include "mpi.h"
using namespace std;
int main(int argc, char **argv)
{
int R,P;
MPI_Status status;
bool check = false;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &P);
MPI_Comm_rank(MPI_COMM_WORLD, &R);
if (R == 0)
{
check = true;
MPI_Send(&check,1,MPI_BYTE,1,1,MPI_COMM_WORLD);
}
else if (R == 1)
{
MPI_Recv(&check,1,MPI_BYTE,0,1,MPI_COMM_WORLD,&status);
cout << R <<"\t check is \t"<< check << endl;
}
MPI_Finalize();
return 0;
}
There are no error messages.