Skip to content
Snippets Groups Projects
Commit 3dd6d466 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Include Vector and Tensor in regtest

parent e18f70bf
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#include "plumed/tools/Tools.h" #include "plumed/tools/Tools.h"
#include <fstream> #include <fstream>
#include <string> #include <string>
#include "plumed/tools/Vector.h"
#include "plumed/tools/Tensor.h"
using namespace PLMD; using namespace PLMD;
...@@ -67,6 +69,35 @@ void run(Communicator& comm){ ...@@ -67,6 +69,35 @@ void run(Communicator& comm){
collect.assign(displace[comm.Get_size()-1]+count[comm.Get_size()-1],0.0); collect.assign(displace[comm.Get_size()-1]+count[comm.Get_size()-1],0.0);
comm.Allgatherv(&a[0],count[comm.Get_rank()],&collect[0],&count[0],&displace[0]); comm.Allgatherv(&a[0],count[comm.Get_rank()],&collect[0],&count[0],&displace[0]);
dump(comm,ofs,collect); dump(comm,ofs,collect);
std::vector<Vector> vec(comm.Get_size());
std::vector<Vector> newvec(comm.Get_size());
for(unsigned i=0;i<vec.size();i++) vec[i]=Vector((i+1)*(comm.Get_rank()+1),(i+1)*(comm.Get_rank()+1)+100,(i+1)*(comm.Get_rank()+1)+200);
if(comm.Get_rank()==0) req=comm.Isend(&vec[0][0],3*vec.size(),1,78);
if(comm.Get_rank()==1) req=comm.Isend(&vec[0][0],3*vec.size(),2,78);
if(comm.Get_rank()==2) req=comm.Isend(&vec[0][0],3*vec.size(),0,78);
if(comm.Get_rank()==0) comm.Recv(&newvec[0][0],3*newvec.size(),2,78);
if(comm.Get_rank()==1) comm.Recv(&newvec[0][0],3*newvec.size(),0,78);
if(comm.Get_rank()==2) comm.Recv(&newvec[0][0],3*newvec.size(),1,78);
req.wait();
for(unsigned i=0;i<vec.size();i++) ofs<<" "<<newvec[i][0]<<" "<<newvec[i][1]<<" "<<newvec[i][2]<<"\n";
std::vector<Tensor> ten(comm.Get_size());
std::vector<Tensor> newten(comm.Get_size());
for(unsigned i=0;i<ten.size();i++)
ten[i]=Tensor((i+1)*(comm.Get_rank()+1),(i+1)*(comm.Get_rank()+1)+100,(i+1)*(comm.Get_rank()+1)+200,
(i+1)*(comm.Get_rank()+1)+300,(i+1)*(comm.Get_rank()+1)+400,(i+1)*(comm.Get_rank()+1)+500,
(i+1)*(comm.Get_rank()+1)+600,(i+1)*(comm.Get_rank()+1)+700,(i+1)*(comm.Get_rank()+1)+800);
if(comm.Get_rank()==0) req=comm.Isend(&ten[0][0][0],9*ten.size(),1,78);
if(comm.Get_rank()==1) req=comm.Isend(&ten[0][0][0],9*ten.size(),2,78);
if(comm.Get_rank()==2) req=comm.Isend(&ten[0][0][0],9*ten.size(),0,78);
if(comm.Get_rank()==0) comm.Recv(&newten[0][0][0],9*newten.size(),2,78);
if(comm.Get_rank()==1) comm.Recv(&newten[0][0][0],9*newten.size(),0,78);
if(comm.Get_rank()==2) comm.Recv(&newten[0][0][0],9*newten.size(),1,78);
req.wait();
for(unsigned i=0;i<ten.size();i++) ofs<<" "<<newten[i][0][0]<<" "<<newten[i][0][1]<<" "<<newten[i][0][2]<<"\n"
<<" "<<newten[i][1][0]<<" "<<newten[i][1][1]<<" "<<newten[i][1][2]<<"\n"
<<" "<<newten[i][2][0]<<" "<<newten[i][2][1]<<" "<<newten[i][2][2]<<"\n";
} }
int main(int argc,char**argv){ int main(int argc,char**argv){
......
...@@ -5,3 +5,15 @@ ...@@ -5,3 +5,15 @@
status 12 status 12
1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36 1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36
1 2 4 3 6 9 1 2 4 3 6 9
3 103 203
6 106 206
9 109 209
3 103 203
303 403 503
603 703 803
6 106 206
306 406 506
606 706 806
9 109 209
309 409 509
609 709 809
...@@ -5,3 +5,15 @@ ...@@ -5,3 +5,15 @@
status 12 status 12
1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36 1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36
1 2 4 3 6 9 1 2 4 3 6 9
1 101 201
2 102 202
3 103 203
1 101 201
301 401 501
601 701 801
2 102 202
302 402 502
602 702 802
3 103 203
303 403 503
603 703 803
...@@ -4,3 +4,15 @@ ...@@ -4,3 +4,15 @@
3 6 9 12 15 18 21 24 27 30 33 36 3 6 9 12 15 18 21 24 27 30 33 36
1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36 1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36
1 2 4 3 6 9 1 2 4 3 6 9
2 102 202
4 104 204
6 106 206
2 102 202
302 402 502
602 702 802
4 104 204
304 404 504
604 704 804
6 106 206
306 406 506
606 706 806
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment