Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 811 Bytes

README.md

File metadata and controls

38 lines (28 loc) · 811 Bytes

kokkos-tiny-ranges

Disclaimer

This is very much WIP, purely a prototype to play with (missing pretty much all the fine-grained details, iterators, etc...) but it works

Snippets

struct IsEven{
  KOKKOS_FUNCTION bool operator()(int v) const{ return v % 2 == 0; };
};

template<class RangeT>
struct MyFunc{
  RangeT r_;

  KOKKOS_FUNCTION
  MyFunc(RangeT r) : r_(r){}

  KOKKOS_FUNCTION void operator()(int i) const{
   auto value = r_(i);
   // do soemthing
  }
};

// example 1
Kokkos::View<int*> view("v", 110);
auto p = view | Kokkos::nonlazy_filter(IsEven());
Kokkos::parallel_for(p.size(), MyFunc(p));

// example 2
Kokkos::View<int*> view("v", 110);
auto p = view | Kokkos::nonlazy_filter(IsEven()) | Kokkos::reverse() | Kokkos::take(2);
Kokkos::parallel_for(p.size(), MyFunc(p));