Repository navigation
Kokkos::fence
Daniel Arndt edited this page May 1, 2020
·
2 revisions
Header File: Kokkos_Core.hpp
In general, kernels in Kokkos are running asynchronously and launching them returns immediately. This implies that its effects might not be visible to the calling thread. Kokkos::fence() guarantees that all parallel patterns in all execution spaces are guaranteed to have completed upon return and that any side-effects are visible. Effectively, calling Kokkos::fence() is equivalent to calling ExecutionSpace::fence() for all enabled execution spaces.
Usage: timing kernels
Kokkos::Timer timer;
// some kernel call, like Kokkos::parallel_for(...);
Kokkos::fence();
double time = timer.seconds();using UVM
Kokkos::View<int*, Kokkos::CudaUVM> view("uvm_view", 10);
Kokkos::parallel_for(10, KOKKOS_LAMBDA (int n) { view(n) = n; });
Kokkos::fence();
for (unsigned int i=0; i<view.size(); ++i)
std::cout << view(i) << std::endl;void fence();~
Home:
- Introduction
- Machine Model
- Programming Model
- Compiling
- Initialization
- View
- Parallel Dispatch
- Hierarchical Parallelism
- Custom Reductions
- Atomic Operations
- Subviews
- Interoperability
- Kokkos and Virtual Functions
- Detection Idiom
- Initialization and Finalization
- View
- Data Parallelism
- Execution Policies
- Spaces
- Task Parallelism
- Utilities
- STL Compatibility