Skip to content
Snippets Groups Projects
Commit 6ecadbbf authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Begining of real 1D test

parent 11df55bf
No related branches found
No related tags found
No related merge requests found
......@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
// Compute the number of even integers from 0 to n-1, in parallel.
long count = 0;
Kokkos::parallel_reduce(n, [=] (const long i, long& lcount) {
Kokkos::parallel_reduce(n, KOKKOS_LAMBDA(const long i, long& lcount) {
lcount += (i % 2) == 0;
}, count);
......@@ -71,7 +71,42 @@ int main(int argc, char *argv[])
count_time = timer.seconds();
std::cout << "Sequential: " << seq_count << ' ' << rang::style::bold << count_time << rang::style::reset << '\n';
const int nj=n;
Kokkos::View<double*> xj("xj", nj);
Kokkos::View<double*> rhoj("rhoj", nj);
Kokkos::View<double*> uj("uj", nj);
Kokkos::View<double*> Ej("Ej", nj);
Kokkos::View<double*> ej("ej", nj);
Kokkos::View<double*> pj("pj", nj);
Kokkos::View<double*> Vj("Vj", nj);
Kokkos::View<double*> gammaj("gammaj", nj);
Kokkos::View<double*> cj("cj", nj);
Kokkos::View<double*> mj("mj", nj);
const int nr=nj+1;
Kokkos::View<double*> xr("xr", nr);
const double delta_x = 1./nj;
timer.reset();
Kokkos::parallel_for(nr, KOKKOS_LAMBDA(const int& r){
xr[r] = r*delta_x;
});
count_time = timer.seconds();
std::cout << " Parallel: " << count << " " << rang::style::bold << count_time << rang::style::reset << '\n';
for (int r=0; r<nr; ++r) {
std::cout << xr[r] << '\n';
}
Kokkos::finalize();
return (count == seq_count) ? 0 : -1;
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment