Kokkos Node API and Local Linear Algebra Kernels Version of the Day

This is an example of the simple kernels KokkosExamples::VecInit and KokkosExamples::VecReduce, as well as their wrappers KokkosExamples::reduceVec() and KokkosExamples::initVec().

#include "Kokkos_NodeExampleKernels.hpp"
#include <Kokkos_DefaultNode.hpp>
#include <Kokkos_NodeHelpers.hpp>

int main() {
  typedef Kokkos::DefaultNode::DefaultNodeType NODE;
  const int VEC_LENGTH = 100;

  Teuchos::RCP<NODE> node = Kokkos::DefaultNode::getDefaultNode();
  Teuchos::ArrayRCP<int> x = node->allocBuffer<int>( VEC_LENGTH );

  KokkosExamples::initVec( node, x );
  int ret = KokkosExamples::reduceVec( node, x );
  std::cout << "Result is " << ret << std::endl;
  if (ret == (VEC_LENGTH-1)*VEC_LENGTH/2) std::cout << "End Result: TEST PASSED" << std::endl;

  return 0;
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends