Skip to content

fnrizzi/kokkos-tiny-ranges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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));

Releases

No releases published

Packages

No packages published