11 #define BOOST_TEST_DYN_LINK
12 #define BOOST_TEST_MODULE "Test module for cf3::common 's parallel environment - part of checking operations handling."
16 #include <boost/test/unit_test.hpp>
36 m_argc = boost::unit_test::framework::master_test_suite().argc;
37 m_argv = boost::unit_test::framework::master_test_suite().argv;
52 static const bool is_commutative=
true;
55 template<
typename T>
static void func(
void* in,
void* out,
int* len,
PE::Datatype* type){
59 for (i=0; i<*len; i++) out_[i]= out_[i]*in_[i];
74 bool operator > (
const optest&
b)
const {
return true; };
87 BOOST_CHECK_EQUAL( mimic_usage(t,
PE::max()), MPI_MAX);
88 BOOST_CHECK_EQUAL( mimic_usage(t,
PE::min()), MPI_MIN);
89 BOOST_CHECK_EQUAL( mimic_usage(t,PE::plus()), MPI_SUM);
90 BOOST_CHECK_EQUAL( mimic_usage(t,PE::multiplies()), MPI_PROD);
91 BOOST_CHECK_EQUAL( mimic_usage(t,PE::logical_and()), MPI_LAND);
92 BOOST_CHECK_EQUAL( mimic_usage(t,PE::logical_or()), MPI_LOR);
93 BOOST_CHECK_EQUAL( mimic_usage(t,PE::logical_xor()), MPI_LXOR);
94 BOOST_CHECK_EQUAL( mimic_usage(t,PE::bitwise_and()), MPI_BAND);
95 BOOST_CHECK_EQUAL( mimic_usage(t,PE::bitwise_or()), MPI_BOR);
96 BOOST_CHECK_EQUAL( mimic_usage(t,PE::bitwise_xor()), MPI_BXOR);
129 test_all_operations<char>();
130 test_all_operations<char>();
131 test_all_operations<unsigned char>();
132 test_all_operations<unsigned char>();
133 test_all_operations<short>();
134 test_all_operations<short>();
135 test_all_operations<unsigned short>();
136 test_all_operations<unsigned short>();
137 test_all_operations<int>();
138 test_all_operations<int>();
139 test_all_operations<unsigned int>();
140 test_all_operations<unsigned int>();
141 test_all_operations<long>();
142 test_all_operations<long>();
143 test_all_operations<unsigned long>();
144 test_all_operations<unsigned long>();
145 test_all_operations<long long>();
146 test_all_operations<long long>();
147 test_all_operations<unsigned long long>();
148 test_all_operations<unsigned long long>();
149 test_all_operations<float>();
150 test_all_operations<float>();
151 test_all_operations<double>();
152 test_all_operations<double>();
153 test_all_operations<long double>();
154 test_all_operations<long double>();
226 BOOST_CHECK_NE( mimic_usage(o,
PE::max()), MPI_MAX);
227 BOOST_CHECK_NE( mimic_usage(o,
PE::min()), MPI_MIN);
228 BOOST_CHECK_NE( mimic_usage(o,PE::plus()), MPI_SUM);
229 BOOST_CHECK_NE( mimic_usage(o,PE::multiplies()), MPI_PROD);
230 BOOST_CHECK_NE( mimic_usage(o,PE::logical_and()), MPI_LAND);
231 BOOST_CHECK_NE( mimic_usage(o,PE::logical_or()), MPI_LOR);
232 BOOST_CHECK_NE( mimic_usage(o,PE::logical_xor()), MPI_LXOR);
233 BOOST_CHECK_NE( mimic_usage(o,PE::bitwise_and()), MPI_BAND);
234 BOOST_CHECK_NE( mimic_usage(o,PE::bitwise_or()), MPI_BOR);
235 BOOST_CHECK_NE( mimic_usage(o,PE::bitwise_xor()), MPI_BXOR);
249 BOOST_AUTO_TEST_SUITE_END()
#define CFinfo
these are always defined
~PEOperationsFixture()
common tear-down for each test case
custom class for checking the non built-in way
PE::Operation mpi_op_customplus_i
data stays in scope for checking if registration is really static
void test_all_operations()
helper function for testing all operations on a type
MPI_Datatype Datatype
datatype
PE::Operation mpi_op_customplus_d
PE::Operation mpi_op_customplus_o
static void func(void *in, void *out, int *len, PE::Datatype *type)
Implementation of the operation. See Operation_create in MPI standard documentation for details...
Real max(const Real a, const Real b)
Maximum between two scalars.
PE::Operation mpi_op_custommult_d
Real min(const Real a, const Real b)
Minimum between two scalars.
BOOST_AUTO_TEST_CASE(init)
void init(int argc=0, char **args=0)
Top-level namespace for coolfluid.
PEOperationsFixture()
common setup for each test case
bool operator<(const Handle< T > &a, const Handle< U > &b)
PE::Operation mpi_op_custommult_i
PE::Operation mpi_op_custommult_o
static Comm & instance()
Return a reference to the current PE.
PE::Operation mimic_usage(T &t, Op)
mimicer function for templatization (basically a substituter for all_reudce)
Most basic kernel library.
MPI_Op Operation
operation (mostly for reduce and all_reduce)
#define PEProcessSortedExecute(irank, expression)