1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/////////////////////////////////////////////////////////////
// //
// Copyright (c) 2003-2014 by The University of Queensland //
// Centre for Geoscience Computing //
// http://earth.uq.edu.au/centre-geoscience-computing //
// //
// Primary Business: Brisbane, Queensland, Australia //
// Licensed under the Open Software License version 3.0 //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
/////////////////////////////////////////////////////////////
//--- MPI ---
#include <mpi.h>
//--- TML ---
#include "comm_world.h"
//--- Test groups ---
#include "test_comm.h"
#include "test_pack.h"
#include "test_cart.h"
#include "test_sc.h"
//--- System includes ---
#include <iostream>
using std::cout;
using std::endl;
using std::flush;
//--- STL ---
#include <vector>
using std::vector;
int main(int argc, char** argv)
{
bool res=true;
MPI_Init(&argc,&argv);
TML_CommWorld worldcomm;
int rank=worldcomm.rank();
// normal communication
if(test_group_comm(&worldcomm,rank)){
cout << "TML_Comm tests sucessfull" << endl << flush;
}else{
res=false;
cout << "TML_Comm tests failed" << endl << flush;
}
MPI_Barrier(MPI_COMM_WORLD);
// packed communication
if(worldcomm.size()==3){ // currently requires 3 nodes
if(test_group_pack(&worldcomm,rank)){
cout << "TML_Comm packed communication tests sucessfull" << endl << flush;
}else{
res=false;
cout << "TML_Comm packed communication tests failed" << endl << flush;
}
}
MPI_Barrier(MPI_COMM_WORLD);
// cartesian communicator communication
if(test_group_cart(&worldcomm,rank)){
cout << "TML_CartComm communication tests sucessfull" << endl << flush;
}else{
res=false;
cout << "TML_CartComm communication tests failed" << endl << flush;
}
MPI_Barrier(MPI_COMM_WORLD);
// scatter/gather tests
if(worldcomm.size()==3){ // currently requires 3 node
if(test_group_sc(&worldcomm,rank)){
cout << "scatter/gather tests sucessfull" << endl << flush;
} else{
res=false;
cout << "scatter/gather tests failed" << endl << flush;
}
}
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
if(res){
cout << rank << " finalized - all tests succeeded" << endl;
} else {
cout << rank << " finalized - some tests failed" << endl;
}
return 0;
}
|