Kokkos Core Kernels Package  Version of the Day
Classes | Functions
Kokkos_Parallel.hpp File Reference

Declaration of parallel operators. More...

#include <cstddef>
#include <Kokkos_Core_fwd.hpp>
#include <Kokkos_View.hpp>
#include <Kokkos_ExecPolicy.hpp>
#include <impl/Kokkos_Tools.hpp>
#include <type_traits>
#include <typeinfo>
#include <impl/Kokkos_Tags.hpp>
#include <impl/Kokkos_Traits.hpp>
#include <impl/Kokkos_FunctorAnalysis.hpp>
#include <impl/Kokkos_FunctorAdapter.hpp>
#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...
 

Functions

template<class ExecPolicy , class FunctorType >
void Kokkos::parallel_for (const ExecPolicy &policy, const FunctorType &functor, const std::string &str="", typename std::enable_if< Kokkos::Impl::is_execution_policy< ExecPolicy >::value >::type *=nullptr)
 Execute functor in parallel according to the execution policy. More...
 

Detailed Description

Declaration of parallel operators.

Definition in file Kokkos_Parallel.hpp.

Function Documentation

◆ parallel_for()

template<class ExecPolicy , class FunctorType >
void Kokkos::parallel_for ( const ExecPolicy &  policy,
const FunctorType &  functor,
const std::string &  str = "",
typename std::enable_if< Kokkos::Impl::is_execution_policy< ExecPolicy >::value >::type *  = nullptr 
)
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 157 of file Kokkos_Parallel.hpp.