3
3
#include < iostream>
4
4
5
5
6
- int main (int argc, char * argv[]) {
7
- std::cout << " hello world" << std::endl;
8
- int N = 40 ;
6
+ int main (int argc, char * argv[])
7
+ {
8
+ std::cout << " dot example: calling kokkos-kernels" << std::endl;
9
+
10
+ std::size_t N = 40 ;
9
11
Kokkos::initialize (argc,argv);
10
12
{
11
13
Kokkos::View<double *> a_view (" A" ,N);
@@ -14,15 +16,15 @@ int main(int argc, char* argv[]) {
14
16
// Requires CTAD working, GCC 11.1 works but some others are buggy
15
17
// std::experimental::mdspan a(a_ptr,N);
16
18
std::experimental::mdspan<double ,std::experimental::extents<std::experimental::dynamic_extent>> a (a_ptr,N);
17
- for (int i=0 ; i<a.extent (0 ); i++) a (i) = i;
19
+ for (std:: size_t i=0 ; i<a.extent (0 ); i++) a (i) = i;
18
20
19
21
// This forwards to KokkosKernels (https://github.com/kokkos/kokkos-kernels
20
22
std::experimental::linalg::scale (KokkosKernelsSTD::kokkos_exec<>(),2.0 ,a);
21
23
// This forwards to KokkosKernels if LINALG_ENABLE_KOKKOS_DEFAULT is ON
22
24
std::experimental::linalg::scale (std::execution::par,2.0 ,a);
23
25
// This goes to the base implementation
24
26
std::experimental::linalg::scale (std::execution::seq,2.0 ,a);
25
- for (int i=0 ; i<a.extent (0 ); i++) printf (" %i %lf\n " ,i,a (i));
27
+ for (std:: size_t i=0 ; i<a.extent (0 ); i++) printf (" %i %lf\n " ,i,a (i));
26
28
}
27
29
Kokkos::finalize ();
28
30
}
0 commit comments