specfem::execution::for_each_level¶
-
template<typename IteratorType, typename ClosureType>
inline void specfem::execution::for_each_level(const std::string &name, const IteratorType &iterator, const ClosureType &closure)¶ This function applies a closure to each index in the given iterator.
The closure passes the closure function to the underlying
base_policy_type. If thebase_policy_typeis a Kokkos policy, it will use the Kokkos parallel_for to execute the closure in parallel.- Parameters:
name – A name for the parallel operation.
iterator – An iterator that provides access to indices. Must be a top-level kokkos policy.
closure – A closure that takes an index and performs some operation. The closure must be invocable with the index type of the iterator.
-
template<typename IteratorType, typename ClosureType>
std::enable_if_t<std::is_same_v<typename IteratorType::execution_space, Kokkos::DefaultHostExecutionSpace>, void> specfem::execution::for_each_level(const IteratorType &iterator, const ClosureType &closure)¶