Kokkos Core Kernels Package Version of the Day
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
Kokkos_Parallel.hpp File Reference

Declaration of parallel operators. More...

#include <Kokkos_Macros.hpp>
#include <Kokkos_Core_fwd.hpp>
#include <Kokkos_DetectionIdiom.hpp>
#include <Kokkos_ExecPolicy.hpp>
#include <Kokkos_View.hpp>
#include <impl/Kokkos_Tools.hpp>
#include <impl/Kokkos_Tools_Generic.hpp>
#include <impl/Kokkos_Traits.hpp>
#include <impl/Kokkos_FunctorAnalysis.hpp>
#include <cstddef>
#include <type_traits>
#include <typeinfo>
#include <Kokkos_Parallel_Reduce.hpp>

Go to the source code of this file.

Classes

struct  Kokkos::Impl::FunctorPolicyExecutionSpace< Functor, Policy >
 Given a Functor and Execution Policy query an execution space. More...
 

Namespaces

namespace  Kokkos::Impl
 ScopeGuard Some user scope issues have been identified with some Kokkos::finalize calls; ScopeGuard aims to correct these issues.
 

Functions

template<class ExecPolicy , class FunctorType , class Enable = std::enable_if_t<is_execution_policy<ExecPolicy>::value>>
void Kokkos::parallel_for (const std::string &str, const ExecPolicy &policy, const FunctorType &functor)
 Execute functor in parallel according to the execution policy.
 

Detailed Description

Declaration of parallel operators.

Definition in file Kokkos_Parallel.hpp.

Function Documentation

◆ parallel_for()

template<class ExecPolicy , class FunctorType , class Enable = std::enable_if_t<is_execution_policy<ExecPolicy>::value>>
void Kokkos::parallel_for ( const std::string & str,
const ExecPolicy & policy,
const FunctorType & functor )
inline

Execute functor in parallel according to the execution policy.

A "functor" is a class containing the function to execute in parallel, data needed for that execution, and an optional execution_space alias. Here is an example functor for parallel_for:

class FunctorType {
public:
using execution_space = ...;
void operator() ( WorkType iwork ) const ;
};

In the above example, WorkType is any integer type for which a valid conversion from size_t to IntType exists. Its operator() method defines the operation to parallelize, over the range of integer indices iwork=[0,work_count-1]. This compares to a single iteration iwork of a for loop. If execution_space is not defined DefaultExecutionSpace will be used.

Definition at line 133 of file Kokkos_Parallel.hpp.