Kokkos Core Kernels Package Version of the Day
Kokkos::Threads Class Reference

Device for a pool of Pthreads or C11 threads on a CPU. More...

#include <Kokkos_Threads.hpp>

List of all members.

Public Types

Type declarations that all Kokkos devices must provide.
typedef Impl::DeviceTag kokkos_tag
 The tag (what type of kokkos_object is this).
typedef Threads device_type
typedef Kokkos::HostSpace memory_space
typedef Threads scratch_memory_space
typedef memory_space::size_type size_type
typedef Kokkos::LayoutRight array_layout
typedef Kokkos::Threads host_mirror_device_type

Public Member Functions

Function for the functor device interface */
KOKKOS_INLINE_FUNCTION int league_rank () const
KOKKOS_INLINE_FUNCTION int league_size () const
KOKKOS_INLINE_FUNCTION int team_rank () const
KOKKOS_INLINE_FUNCTION int team_size () const
KOKKOS_INLINE_FUNCTION void team_barrier ()
template<typename Type >
KOKKOS_INLINE_FUNCTION Type team_scan (const Type &value)
 Intra-team exclusive prefix sum with team_rank() ordering.
template<typename TypeLocal , typename TypeGlobal >
KOKKOS_INLINE_FUNCTION TypeGlobal team_scan (const TypeLocal &value, TypeGlobal *const global_accum)
 Intra-team exclusive prefix sum with team_rank() ordering with intra-team non-deterministic ordering accumulation.
KOKKOS_INLINE_FUNCTION void * get_shmem (const int size) const
 Threads (Impl::ThreadsExec &)

Static Public Member Functions

Static functions that all Kokkos devices must implement.
static int in_parallel ()
 True if and only if this method is being called in a thread-parallel function.
static bool sleep ()
 Set the device in a "sleep" state.
static bool wake ()
 Wake the device from the 'sleep' state so it is ready for work.
static void fence ()
 Wait until all dispatched functors complete.
static void finalize ()
 Free any resources being consumed by the device.
static void print_configuration (std::ostream &, const bool detail=false)
 Print configuration information to the given output stream.
Device-specific functions
static void initialize (unsigned threads_count=1, unsigned use_numa_count=0, unsigned use_cores_per_numa=0, bool allow_asynchronous_threadpool=false)
 Initialize the device in the "ready to work" state.
static int is_initialized ()
static Threadsinstance (int=0)
static KOKKOS_INLINE_FUNCTION
unsigned 
team_max ()
 Maximum size of a single thread team.
static KOKKOS_INLINE_FUNCTION
unsigned 
team_recommended ()
static KOKKOS_INLINE_FUNCTION
unsigned 
hardware_thread_id ()
static KOKKOS_INLINE_FUNCTION
unsigned 
max_hardware_threads ()

Detailed Description

Device for a pool of Pthreads or C11 threads on a CPU.

Definition at line 69 of file Kokkos_Threads.hpp.


Member Typedef Documentation

typedef Impl::DeviceTag Kokkos::Threads::kokkos_tag

The tag (what type of kokkos_object is this).

Definition at line 74 of file Kokkos_Threads.hpp.


Member Function Documentation

static int Kokkos::Threads::in_parallel ( ) [static]

True if and only if this method is being called in a thread-parallel function.

static bool Kokkos::Threads::sleep ( ) [static]

Set the device in a "sleep" state.

This function sets the device in a "sleep" state in which it is not ready for work. This may consume less resources than if the device were in an "awake" state, but it may also take time to bring the device from a sleep state to be ready for work.

Returns:
True if the device is in the "sleep" state, else false if the device is actively working and could not enter the "sleep" state.
static bool Kokkos::Threads::wake ( ) [static]

Wake the device from the 'sleep' state so it is ready for work.

Returns:
True if the device is in the "ready" state, else "false" if the device is actively working (which also means that it's awake).
static void Kokkos::Threads::fence ( ) [static]

Wait until all dispatched functors complete.

The parallel_for or parallel_reduce dispatch of a functor may return asynchronously, before the functor completes. This method does not return until all dispatched functors on this device have completed.

static void Kokkos::Threads::finalize ( ) [static]

Free any resources being consumed by the device.

For the Threads device, this terminates spawned worker threads.

static void Kokkos::Threads::print_configuration ( std::ostream &  ,
const bool  detail = false 
) [static]

Print configuration information to the given output stream.

template<typename Type >
KOKKOS_INLINE_FUNCTION Type Kokkos::Threads::team_scan ( const Type &  value)

Intra-team exclusive prefix sum with team_rank() ordering.

The highest rank thread can compute the reduction total as reduction_total = dev.team_scan( value ) + value ;

template<typename TypeLocal , typename TypeGlobal >
KOKKOS_INLINE_FUNCTION TypeGlobal Kokkos::Threads::team_scan ( const TypeLocal &  value,
TypeGlobal *const  global_accum 
)

Intra-team exclusive prefix sum with team_rank() ordering with intra-team non-deterministic ordering accumulation.

The global inter-team accumulation value will, at the end of the league's parallel execution, be the scan's total. Parallel execution ordering of the league's teams is non-deterministic. As such the base value for each team's scan operation is similarly non-deterministic.

static void Kokkos::Threads::initialize ( unsigned  threads_count = 1,
unsigned  use_numa_count = 0,
unsigned  use_cores_per_numa = 0,
bool  allow_asynchronous_threadpool = false 
) [static]

Initialize the device in the "ready to work" state.

The device is initialized in a "ready to work" or "awake" state. This state reduces latency and thus improves performance when dispatching work. However, the "awake" state consumes resources even when no work is being done. You may call sleep() to put the device in a "sleeping" state that does not consume as many resources, but it will take time (latency) to awaken the device again (via the wake()) method so that it is ready for work.

Teams of threads are distributed as evenly as possible across the requested number of numa regions and cores per numa region. A team will not be split across a numa region.

If the 'use_' arguments are not supplied the hwloc is queried to use all available cores.

static KOKKOS_INLINE_FUNCTION unsigned Kokkos::Threads::team_max ( ) [static]

Maximum size of a single thread team.

If a parallel_{for,reduce,scan} operation requests a team_size that does not satisfy the condition: 0 == team_max() % team_size then some threads will idle.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends