47 #include <Teuchos_DefaultMpiComm.hpp> 49 #include <Tpetra_ConfigDefs.hpp> 51 #undef HAVE_KOKKOSCLASSIC_THRUST 53 #include <Tpetra_HybridPlatform.hpp> 54 #include <Tpetra_Map.hpp> 55 #include <Tpetra_Vector.hpp> 56 #include <Tpetra_RTI.hpp> 65 S operator()(
const S &s1,
const S &s2) {
return s2;}
80 const size_t numLocal = 1000*comm->getSize();
81 auto map = Tpetra::createContigMapWithNode<int,int>(INVALID,numLocal,comm,node);
82 auto dx = Tpetra::createVector<double>(map),
83 dy = Tpetra::createVector<double>(map);
94 TPETRA_BINARY_TRANSFORM( dy, dx, dx );
98 float fresult;
double dresult;
99 auto fx = Tpetra::createVector<float>(map),
100 fy = Tpetra::createVector<float>(map);
101 TPETRA_BINARY_TRANSFORM( fx, dx, (
float)dx );
102 TPETRA_BINARY_TRANSFORM( fy, dy, (
float)dy );
104 fresult =
reduce(*fx, *fy, reductionGlob<ZeroOp<double>>(std::multiplies<float>(), std::plus<double>()) );
106 fresult = TPETRA_REDUCE2( fx, fy, fx*fy, ZeroOp<double>, std::plus<double>() );
109 dresult = TPETRA_REDUCE2( dx, dy, dx*dy, ZeroOp<double>, std::plus<double>() );
110 if (comm->getRank() == 0) {
111 std::cout <<
" Float product/double accumulator: " << fresult << std::endl;
112 std::cout <<
"Double product/double accumulator: " << dresult << std::endl;
117 template <
class Node>
123 std::cout <<
"Running test with Node==" <<
Teuchos::typeName(*node) <<
" on rank " << comm->getRank() <<
"/" << comm->getSize() << std::endl;
124 simple_rti_examples<Node>(comm,node);
129 int main(
int argc,
char **argv) {
136 std::string machine_list(
138 " <ParameterList name='%1=0'> " 139 " <Parameter name='NodeType' type='string' value='Kokkos::SerialNode'/> " 141 " <ParameterList name='=-1'> " 142 " <Parameter name='NodeType' type='string' value='Kokkos::OpenMPNode'/> " 143 " <Parameter name='Verbose' type='int' value='0'/> " 144 " <Parameter name='Num Threads' type='int' value='-1'/> " 146 " <ParameterList name='=-2'> " 147 " <Parameter name='NodeType' type='string' value='Kokkos::TBBNode'/> " 148 " <Parameter name='Verbose' type='int' value='0'/> " 149 " <Parameter name='Num Threads' type='int' value='-1'/> " 151 " <ParameterList name='=-3'> " 152 " <Parameter name='NodeType' type='string' value='Kokkos::TPINode'/> " 153 " <Parameter name='Verbose' type='int' value='0'/> " 154 " <Parameter name='Num Threads' type='int' value='0'/> " 156 " <ParameterList name='=-4'> " 157 " <Parameter name='NodeType' type='string' value='Kokkos::ThrustGPUNode'/> " 158 " <Parameter name='Verbose' type='int' value='0'/> " 159 " <Parameter name='Device Number' type='int' value='0'/> " 167 Teuchos::updateParametersFromXmlString(machine_list, inOutArg(machPL));
169 platform.runUserCode<runTest>();
171 if (comm->getRank() == 0) std::cout <<
"End Result: TEST PASSED" << std::endl;
void binary_transform(Vector< S1, LO, GO, Node > &vec_inout, const Vector< S2, LO, GO, Node > &vec_in2, OP op)
Transform values of vec_inout using vec_inout, vec_in2 and operator op.
size_t global_size_t
Global size_t object.
Glob::RedOP::result_type reduce(const Vector< S, LO, GO, Node > &vec_in, Glob glob)
Reduce values of vec_in using the operators instantiated in glob.
ReductionGlob< GOP, ROP, IOP > reductionGlob(GOP gop, ROP rop)
Non-member constructor to instantiate a type glob of a static identity functor and generation and red...
A static identity functor, providing a static method identity() that returns zero.
void unary_transform(Vector< S, LO, GO, Node > &vec_inout, OP op)
Transform values of vec_inout using via operator op.
std::string typeName(const T &t)