Kokkos Node API and Local Linear Algebra Kernels Version of the Day
Public Member Functions | Static Public Member Functions | Static Public Attributes
Kokkos::OpenMPNode Class Reference

Kokkos Node using OpenMP for parallelization. More...

#include <Kokkos_OpenMPNode.hpp>

Inheritance diagram for Kokkos::OpenMPNode:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 OpenMPNode (Teuchos::ParameterList &pl)
 Constructor.
 OpenMPNode ()
 Default constructor (sets default parameter values).
 ~OpenMPNode ()
 Destructor.
void init (int numThreads)
 Set the number of threads that OpenMP should use.
void sync () const
 Synchronize threads; this is a no-op for OpenMPNode.
template<class T >
ArrayRCP< T > allocBuffer (size_t size)
 Allocate a parallel buffer, returning it as a pointer ecnapsulated in an ArrayRCP.
template<class T >
void copyFromBuffer (size_t size, const ArrayRCP< const T > &buffSrc, const ArrayView< T > &hostDest)
 Copy data to host memory from a parallel buffer.
template<class T >
void copyToBuffer (size_t size, const ArrayView< const T > &hostSrc, const ArrayRCP< T > &buffDest)
 Copy data to host memory from a parallel buffer.
template<class T >
void copyBuffers (size_t size, const ArrayRCP< const T > &buffSrc, const ArrayRCP< T > &buffDest)
 Copy data between buffers.
template<class T >
ArrayRCP< const T > viewBuffer (size_t size, ArrayRCP< const T > buff)
 Return a const view of a buffer for use on the host.
template<class T >
ArrayRCP< T > viewBufferNonConst (ReadWriteOption rw, size_t size, const ArrayRCP< T > &buff)
 Return a non-const view of a buffer for use on the host.

Static Public Member Functions

template<class WDP >
static void parallel_for (int beg, int end, WDP wd)
 Perform a parallel for loop on the given half-exclusive index range.
template<class WDP >
static WDP::ReductionType parallel_reduce (int beg, int end, WDP wd)
 Perform a parallel reduction on the given half-exclusive index range.

Static Public Attributes

static const bool isHostNode = true
 Indicates that parallel buffers allocated by this node are available for use on the host thread.

Detailed Description

Kokkos Node using OpenMP for parallelization.

Definition at line 60 of file Kokkos_OpenMPNode.hpp.


Constructor & Destructor Documentation

Kokkos::OpenMPNode::OpenMPNode ( Teuchos::ParameterList pl)

Constructor.

The constructor currently accepts the following (optional) parameters:

  • "Num Threads" (int): The number of threads that OpenMP should use. If not provided, or if -1 or 0, OpenMP will pick the number of threads in the usual way.
  • "Verbose" (int): If nonzero, the Kokkos Node will print status output to std::cout.
Warning:
If you set the "Num Threads" parameter to a positive value, this will set the number of threads that _all_ OpenMPNode instances will use, not just this one.

Definition at line 55 of file Kokkos_OpenMPNode.cpp.

Kokkos::OpenMPNode::OpenMPNode ( )

Default constructor (sets default parameter values).

For parameters and their default values, see the documentation of the constructor that accepts a ParameterList input / output argument.

Definition at line 47 of file Kokkos_OpenMPNode.cpp.

Kokkos::OpenMPNode::~OpenMPNode ( )

Destructor.

Definition at line 110 of file Kokkos_OpenMPNode.cpp.


Member Function Documentation

void Kokkos::OpenMPNode::init ( int  numThreads)

Set the number of threads that OpenMP should use.

It's not necessary to call this method unless you want to change the number of threads that OpenMP should use, after constructing the Kokkos Node instance.

Warning:
This method will affect the number of threads used by all OpenMPNode instances.
Parameters:
numThreads[in] The number of threads that OpenMP should use. Ignored if -1 or 0.

Definition at line 112 of file Kokkos_OpenMPNode.cpp.

template<class WDP >
static void Kokkos::OpenMPNode::parallel_for ( int  beg,
int  end,
WDP  wd 
) [inline, static]

Perform a parallel for loop on the given half-exclusive index range.

Definition at line 103 of file Kokkos_OpenMPNode.hpp.

template<class WDP >
static WDP::ReductionType Kokkos::OpenMPNode::parallel_reduce ( int  beg,
int  end,
WDP  wd 
) [inline, static]

Perform a parallel reduction on the given half-exclusive index range.

Definition at line 113 of file Kokkos_OpenMPNode.hpp.

void Kokkos::OpenMPNode::sync ( ) const [inline]

Synchronize threads; this is a no-op for OpenMPNode.

Definition at line 130 of file Kokkos_OpenMPNode.hpp.

template<class T >
ArrayRCP<T> Kokkos::StandardNodeMemoryModel::allocBuffer ( size_t  size) [inline, inherited]

Allocate a parallel buffer, returning it as a pointer ecnapsulated in an ArrayRCP.

Dereferencing the returned ArrayRCP or its underlying pointer in general results in undefined behavior outside of parallel computations.

The buffer will be automatically freed by the Node when no more references remain.

Template Parameters:
TThe data type of the allocate buffer. This is used to perform alignment and determine the number of bytes to allocate.
Parameters:
[in]sizeThe size requested for the parallel buffer, greater than zero.
Postcondition:
The method will return an ArrayRCP encapsulating a pointer. The underlying pointer may be used in parallel computation routines, and is guaranteed to have size large enough to reference size number of entries of type T.

Definition at line 80 of file Kokkos_StandardNodeMemoryModel.hpp.

template<class T >
void Kokkos::StandardNodeMemoryModel::copyFromBuffer ( size_t  size,
const ArrayRCP< const T > &  buffSrc,
const ArrayView< T > &  hostDest 
) [inline, inherited]

Copy data to host memory from a parallel buffer.

Parameters:
[in]sizeThe number of entries to copy from buffSrc to hostDest.
[in]buffSrcThe parallel buffer from which to copy.
[out]hostDestThe location in host memory where the data from buffSrc is copied to.
Precondition:
size is non-negative.
buffSrc has length at least size.
hostDest has length equal to size.
Postcondition:
On return, entries in the range [0 , size) of buffSrc have been copied to hostDest entries in the range [0 , size).

Definition at line 103 of file Kokkos_StandardNodeMemoryModel.hpp.

template<class T >
void Kokkos::StandardNodeMemoryModel::copyToBuffer ( size_t  size,
const ArrayView< const T > &  hostSrc,
const ArrayRCP< T > &  buffDest 
) [inline, inherited]

Copy data to host memory from a parallel buffer.

Parameters:
[in]sizeThe number of entries to copy from hostSrc to buffDest.
[in]hostSrcThe location in host memory from where the data is copied.
[out]buffDestThe parallel buffer to which the data is copied.
Precondition:
size is non-negative.
hostSrc has length equal to size.
buffSrc has length at least size.
Postcondition:
On return, entries in the range [0 , size) of hostSrc are allowed to be written to. The data is guaranteed to be present in buffDest before it is used in a parallel computation.

Definition at line 123 of file Kokkos_StandardNodeMemoryModel.hpp.

template<class T >
void Kokkos::StandardNodeMemoryModel::copyBuffers ( size_t  size,
const ArrayRCP< const T > &  buffSrc,
const ArrayRCP< T > &  buffDest 
) [inline, inherited]

Copy data between buffers.

Parameters:
[in]sizeThe size of the copy, greater than zero.
[in]buffSrcThe source buffer, with length at least as large as size.
[in,out]buffDestThe destination buffer, with length at least as large as size.
Postcondition:
The data is guaranteed to have been copied before any other usage of buffSrc or buffDest occurs.

Definition at line 140 of file Kokkos_StandardNodeMemoryModel.hpp.

template<class T >
ArrayRCP<const T> Kokkos::StandardNodeMemoryModel::viewBuffer ( size_t  size,
ArrayRCP< const T >  buff 
) [inline, inherited]

Return a const view of a buffer for use on the host.

Definition at line 152 of file Kokkos_StandardNodeMemoryModel.hpp.

template<class T >
ArrayRCP<T> Kokkos::StandardNodeMemoryModel::viewBufferNonConst ( ReadWriteOption  rw,
size_t  size,
const ArrayRCP< T > &  buff 
) [inline, inherited]

Return a non-const view of a buffer for use on the host.

Definition at line 161 of file Kokkos_StandardNodeMemoryModel.hpp.


Member Data Documentation

const bool Kokkos::StandardNodeMemoryModel::isHostNode = true [static, inherited]

Indicates that parallel buffers allocated by this node are available for use on the host thread.

Definition at line 61 of file Kokkos_StandardNodeMemoryModel.hpp.


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