Skip to content
Snippets Groups Projects
Commit ec967016 authored by Paul Heinzlreiter's avatar Paul Heinzlreiter
Browse files

* working communication

parent e344bc7c
Branches
No related merge requests found
......@@ -27,6 +27,7 @@ namespace nbody {
int currentSize;
bodies.clear();
//TODO: change to .Probe
while (!MPI::COMM_WORLD.Iprobe(source, 0, status));
currentSource = status.Get_source();
currentSize = status.Get_count(*(this->datatype));
......@@ -227,20 +228,29 @@ namespace nbody {
*/
void MpiBodyComm::testing(vector<Body>& data, int myRank) {
Body b[4];
vector<Body> vb;
//Body b[4];
//vector<Body> vb;
/*
for (int i = 0; i < 4; i++) {
vb.push_back(b[i]);
}
*/
if (myRank == 0) {
//MPI::COMM_WORLD.Send(b, 4, *this->datatype, 1, 0);
MPI::COMM_WORLD.Send(&vb[0], 4, *this->datatype, 1, 0);
MPI::COMM_WORLD.Send(&data[0], data.size(), *this->datatype, 1, 0);
} else if (myRank == 1) {
//MPI::COMM_WORLD.Recv(b, 4, *this->datatype, 0, 0);
vb.resize(4);
MPI::COMM_WORLD.Recv(&vb[0], 4, *this->datatype, 0, 0);
MPI::Status status;
vector<Body> vb;
MPI::COMM_WORLD.Probe(0, 0, status);
vb.resize(status.Get_count(*this->datatype));
MPI::COMM_WORLD.Recv(&vb[0], status.Get_count(*this->datatype), *this->datatype, 0, 0);
cout << "SIZE: " << vb.size() << endl;
for (int i = 0; i < vb.size(); i++) {
vb[i].print();
}
}
//MPI::Datatype btype = MPI::DATATYPE_NULL;
//int bodySize = data.size();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment