COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-parallel-collective.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 //
7 // IMPORTANT:
8 // run it both on 1 and many cores
9 // for example: mpirun -np 4 ./test-parallel-environment --report_level=confirm or --report_level=detailed
10 
11 #define BOOST_TEST_DYN_LINK
12 #define BOOST_TEST_MODULE "Test module for cf3::common 's parallel environment - part of testing collective communications."
13 
15 
16 #include <vector>
17 
18 #include <boost/test/unit_test.hpp>
19 #include <boost/lambda/lambda.hpp>
20 #include <boost/foreach.hpp>
21 #include <boost/thread/thread.hpp>
22 
23 #include "common/Log.hpp"
24 #include "common/PE/Comm.hpp"
25 #include "common/PE/debug.hpp"
26 #include "common/PE/datatype.hpp"
27 #include "common/PE/operations.hpp"
28 #include "common/PE/all_to_all.hpp"
29 #include "common/PE/all_reduce.hpp"
30 #include "common/PE/reduce.hpp"
31 #include "common/PE/scatter.hpp"
32 #include "common/PE/broadcast.hpp"
33 #include "common/PE/gather.hpp"
34 #include "common/PE/all_gather.hpp"
35 
37 
38 using namespace cf3;
39 using namespace cf3::common;
40 
42 
44 {
47  {
48  m_argc = boost::unit_test::framework::master_test_suite().argc;
49  m_argv = boost::unit_test::framework::master_test_suite().argv;
50  }
51 
54 
56  int m_argc;
57  char** m_argv;
58 
59 };
60 
62 
63 BOOST_FIXTURE_TEST_SUITE( PECollectiveSuite, PECollectiveFixture )
64 
65 
68 {
69  PE::Comm::instance().init(m_argc,m_argv);
70  BOOST_CHECK_EQUAL( PE::Comm::instance().is_active() , true );
71  CFinfo.setFilterRankZero(false);
72  PEProcessSortedExecute(-1,CFinfo << "Proccess " << PE::Comm::instance().rank() << "/" << PE::Comm::instance().size() << " reports in." << CFendl;);
73 }
74 
76 
84 
86 
88 {
89  PEProcessSortedExecute(-1,CFinfo << "Proccess " << PE::Comm::instance().rank() << "/" << PE::Comm::instance().size() << " says good bye." << CFendl;);
90  CFinfo.setFilterRankZero(true);
92  BOOST_CHECK_EQUAL( PE::Comm::instance().is_active() , false );
93 }
94 
96 
97 BOOST_AUTO_TEST_SUITE_END()
98 
99 
#define CFinfo
these are always defined
Definition: Log.hpp:104
#define CFendl
Definition: Log.hpp:109
void init(int argc=0, char **args=0)
Definition: Comm.cpp:80
Top-level namespace for coolfluid.
Definition: Action.cpp:18
~PECollectiveFixture()
common tear-down for each test case
BOOST_FIXTURE_TEST_CASE(init, PECollectiveFixture)
static Comm & instance()
Return a reference to the current PE.
Definition: Comm.cpp:44
PECollectiveFixture()
common setup for each test case
Most basic kernel library.
Definition: Action.cpp:19
#define PEProcessSortedExecute(irank, expression)
Definition: debug.hpp:43
Send comments to:
COOLFluiD Web Admin