This repository has been archived by the owner on Apr 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Kokkos::fence
Christian Trott edited this page Feb 8, 2022
·
4 revisions
Header File: Kokkos_Core.hpp
Usage:
Kokkos::fence();
Blocks on completion of all outstanding asynchronous Kokkos operations. That includes parallel dispatch (e.g. parallel_for, parallel_reduce and parallel_scan) as well as asynchronous data operations such as three-argument deep_copy.
Note: there is a execution space instance specific fence
too: ExecutionSpaceConcept
void Kokkos::fence();
void Kokkos::fence(const std::string& label);
-
label
: A label to identify a specific fence in fence profiling operations.label
does not have to be unique.
-
Kokkos::fence()
cannot be called inside an existing parallel region (i.e. inside theoperator()
of a functor or lambda).
- Blocks on completion of all outstanding asynchronous works. Side effects of outstanding work will be observable upon completion of the
fence
call - that meansKokkos::fence()
implies a memory fence.
Kokkos::Timer timer;
// This operation is asynchronous, without a fence
// one would time only the launch overhead
Kokkos::parallel_for("Test", N, functor);
Kokkos::fence();
double time = timer.seconds();
Kokkos::deep_copy(exec1, a,b);
Kokkos::deep_copy(exec2, a,b);
// do some stuff which doesn't touch a or b
Kokkos::parallel_for("Test", N, functor);
// wait for all three operations to finish
Kokkos::fence();
// do something with a and b
~
Home:
- Introduction
- Machine Model
- Programming Model
- Compiling
- Initialization
- View
- Parallel Dispatch
- Hierarchical Parallelism
- Custom Reductions
- Atomic Operations
- Subviews
- Interoperability
- Kokkos and Virtual Functions
- Initialization and Finalization
- View
- Data Parallelism
- Execution Policies
- Spaces
- Task Parallelism
- Utilities
- STL Compatibility
- Numerics
- Detection Idiom