File: is_mpi_op_test.cpp

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (34 lines) | stat: -rw-r--r-- 1,385 bytes parent folder | download | duplicates (7)
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
// Copyright (C) 2005-2006 Douglas Gregor <doug.gregor@gmail.com>

// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

// A test of the is_mpi_op functionality.
#include <boost/mpi/operations.hpp>
#include <boost/mpi/environment.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/test/minimal.hpp>

using namespace boost::mpi;
using namespace std;
using boost::is_base_and_derived;

int test_main(int argc, char* argv[])
{
  boost::mpi::environment env(argc, argv);

  // Check each predefined MPI_Op type that we support directly.
  BOOST_CHECK((is_mpi_op<maximum<int>, int>::op() == MPI_MAX));
  BOOST_CHECK((is_mpi_op<minimum<float>, float>::op() == MPI_MIN));
  BOOST_CHECK((is_mpi_op<plus<double>, double>::op() == MPI_SUM));
  BOOST_CHECK((is_mpi_op<multiplies<long>, long>::op() == MPI_PROD));
  BOOST_CHECK((is_mpi_op<logical_and<int>, int>::op() == MPI_LAND));
  BOOST_CHECK((is_mpi_op<bitwise_and<int>, int>::op() == MPI_BAND));
  BOOST_CHECK((is_mpi_op<logical_or<int>, int>::op() == MPI_LOR));
  BOOST_CHECK((is_mpi_op<bitwise_or<int>, int>::op() == MPI_BOR));
  BOOST_CHECK((is_mpi_op<logical_xor<int>, int>::op() == MPI_LXOR));
  BOOST_CHECK((is_mpi_op<bitwise_xor<int>, int>::op() == MPI_BXOR));

  return 0;
}