PFUNC  1.0
Namespaces | Classes | Typedefs | Functions
pfunc Namespace Reference

Namespace for the C++ interface of PFUNC. More...

Namespaces

namespace  detail
namespace  global

Classes

struct  default_tag
struct  sched_tag
struct  comp_tag
struct  func_tag
struct  default_type
struct  default_type< sched_tag >
struct  default_type< comp_tag >
struct  default_type< func_tag >
struct  generator
struct  use_default
struct  generator< use_default, use_default, use_default >
struct  generator< SchedPolicyName, use_default, use_default >
struct  generator< use_default, Compare, use_default >
struct  generator< use_default, use_default, Functor >
struct  generator< SchedPolicyName, Compare, use_default >
struct  generator< SchedPolicyName, use_default, Functor >
struct  generator< use_default, Compare, Functor >
struct  parallel_for
struct  parallel_reduce
struct  parallel_while
struct  space_1D
struct  errorS
struct  fifoS
struct  lifoS
struct  prioS
struct  cilkS
struct  virtual_functor
 Virtual base class that is the default functor used. More...

Typedefs

typedef int error_code_type

Functions

template<typename Attribute >
static void attr_priority_set (Attribute &attr, const typename Attribute::priority_type &pri)
template<typename Attribute >
static void attr_priority_get (const Attribute &attr, typename Attribute::priority_type &pri)
template<typename Attribute >
static void attr_qnum_set (Attribute &attr, const typename Attribute::qnum_type &qnum)
template<typename Attribute >
static void attr_qnum_get (const Attribute &attr, typename Attribute::qnum_type &qnum)
template<typename Attribute >
static void attr_num_waiters_set (Attribute &attr, const typename Attribute::num_waiters_type &nwait)
template<typename Attribute >
static void attr_num_waiters_get (const Attribute &attr, typename Attribute::num_waiters_type &nwait)
template<typename Attribute >
static void attr_nested_set (Attribute &attr, const typename Attribute::nested_type &nested)
template<typename Attribute >
static void attr_nested_get (const Attribute &attr, typename Attribute::nested_type &nested)
template<typename Attribute >
static void attr_level_set (Attribute &attr, const typename Attribute::level_type &level)
template<typename Attribute >
static void attr_level_get (Attribute &attr, typename Attribute::level_type &level)
template<typename Attribute >
static void attr_grouped_set (Attribute &attr, const typename Attribute::grouped_type &grouped)
template<typename Attribute >
static void attr_grouped_get (const Attribute &attr, typename Attribute::grouped_type &grouped)
static void group_id_set (group &grp, const unsigned int &id)
static void group_id_get (const group &grp, unsigned int &id)
static void group_size_set (group &grp, const unsigned int &size)
static void group_size_get (const group &grp, unsigned int &size)
static void group_barrier_set (group &grp, const unsigned int &barr)
static void group_barrier_get (const group &grp, unsigned int &barr)
template<typename TaskManager >
static unsigned int thread_id (const TaskManager &tmanager)
template<typename TaskManager >
static void group_rank (const TaskManager &tmanager, unsigned int &rank)
template<typename TaskManager >
static void group_size (const TaskManager &tmanager, unsigned int &size)
template<typename TaskManager , typename TaskType >
static void wait (TaskManager &tmanager, TaskType *task)
template<typename TaskManager , typename TaskType >
static void wait (TaskManager &tmanager, TaskType &task)
template<typename TaskManager , typename ForwardIterator >
static void wait_any (TaskManager &tmanager, ForwardIterator first, ForwardIterator last, int *completion_arr)
template<typename TaskManager , typename ForwardIterator >
static void wait_all (TaskManager &tmanager, ForwardIterator first, ForwardIterator last)
template<typename TaskManager , typename TaskType >
static bool test (TaskManager &tmanager, TaskType &task)
template<typename TaskManager , typename ForwardIterator >
static bool test_all (TaskManager &tmanager, ForwardIterator first, ForwardIterator last, int *completion_arr)
template<typename TaskManager >
static void barrier (TaskManager &tmanager)
template<typename TaskManager >
static void spawn (TaskManager &tmanager, typename TaskManager::task &task, const typename TaskManager::attribute &attr, group &grp, typename TaskManager::functor &func)
template<typename TaskManager >
static void spawn (TaskManager &tmanager, typename TaskManager::task &task, typename TaskManager::functor &func)
template<typename TaskManager >
static void spawn (TaskManager &tmanager, typename TaskManager::task &task, const typename TaskManager::attribute &attr, typename TaskManager::functor &func)
template<typename TaskManager >
static void taskmgr_max_attempts_set (TaskManager &tmanager, const unsigned int &attempts)
template<typename TaskManager >
static void taskmgr_max_attempts_get (TaskManager &tmanager, unsigned int &attempts)
template<typename TaskMgr >
static void get_num_queues (const TaskMgr &tmanager, unsigned int &num_queues)
template<typename TaskMgr >
static void get_num_threads (const TaskMgr &tmanager, unsigned int &num_threads)

Detailed Description

Namespace for the C++ interface of PFUNC.

We include all the relevant header files here so that the users do not have to figure out which header files to include when they need functions

Putting all the public structures here under the namespace ``pfunc'' since there are going to inevitably be a couple of name clashes between the C and the C++ interface. For example, ``work_func_t'' is a class in the C++ interface and a function pointer in the C interface.


Typedef Documentation

Type of the error code


Function Documentation

template<typename Attribute >
static void pfunc::attr_grouped_get ( const Attribute &  attr,
typename Attribute::grouped_type &  grouped 
) [inline, static]
Parameters:
[in]attrAttribute whose grouped nature is to be retrieved.
[out]groupedDetermines the if the attribute is grouped.
template<typename Attribute >
static void pfunc::attr_grouped_set ( Attribute &  attr,
const typename Attribute::grouped_type &  grouped 
) [inline, static]
Parameters:
[out]attrAttribute whose group is to be set/unset.
[in]groupedDetermines the if the attribute is grouped.
template<typename Attribute >
static void pfunc::attr_level_get ( Attribute &  attr,
typename Attribute::level_type &  level 
) [inline, static]
Parameters:
[out]attrAttribute whose level is to be retrieved.
[in]levelLevel the attribute.
template<typename Attribute >
static void pfunc::attr_level_set ( Attribute &  attr,
const typename Attribute::level_type &  level 
) [inline, static]
Parameters:
[out]attrAttribute whose level is to be set.
[in]levelLevel the attribute.
template<typename Attribute >
static void pfunc::attr_nested_get ( const Attribute &  attr,
typename Attribute::nested_type &  nested 
) [inline, static]
Parameters:
[in]attrAttribute whose nestedness is to be retrieved.
[out]nestedNestedness for the given attribute.
template<typename Attribute >
static void pfunc::attr_nested_set ( Attribute &  attr,
const typename Attribute::nested_type &  nested 
) [inline, static]
Parameters:
[out]attrAttribute whose nestedness is to be set.
[in]nestedNestedness of the attribute.
template<typename Attribute >
static void pfunc::attr_num_waiters_get ( const Attribute &  attr,
typename Attribute::num_waiters_type &  nwait 
) [inline, static]
Parameters:
[in]attrAttribute whose number of waiters is to be retrieved.
[out]nwaitNumber of waiters for the given attribute.
template<typename Attribute >
static void pfunc::attr_num_waiters_set ( Attribute &  attr,
const typename Attribute::num_waiters_type &  nwait 
) [inline, static]
Parameters:
[out]attrAttribute whose number of waiters is to be set
[in]nwaitNumber of waiters for the attribute.
template<typename Attribute >
static void pfunc::attr_priority_get ( const Attribute &  attr,
typename Attribute::priority_type &  pri 
) [inline, static]
Parameters:
[in]attrAttribute whose priority is to be retrieved
[out]priPriority for the given attribute
template<typename Attribute >
static void pfunc::attr_priority_set ( Attribute &  attr,
const typename Attribute::priority_type &  pri 
) [inline, static]
Parameters:
[out]attrAttribute whose priority is to be set
[in]priPriority for the attribute
template<typename Attribute >
static void pfunc::attr_qnum_get ( const Attribute &  attr,
typename Attribute::qnum_type &  qnum 
) [inline, static]
Parameters:
[in]attrAttribute whose queue number is to be retrieved
[out]qnumQueue number for the given attribute
template<typename Attribute >
static void pfunc::attr_qnum_set ( Attribute &  attr,
const typename Attribute::qnum_type &  qnum 
) [inline, static]
Parameters:
[out]attrAttribute whose queue number is to be set
[in]qnumQueue number for the attribute.
template<typename TaskManager >
static void pfunc::barrier ( TaskManager &  tmanager) [inline, static]

Executes a barrier across the tasks associated with the specified group. The group is automatically gotten from the task that called barrier. For context, the taskmanager running all the tasks has to be passed in as an argument.

Parameters:
[in]tmanagerThe task manager that is running the tasks.
template<typename TaskMgr >
static void pfunc::get_num_queues ( const TaskMgr &  tmanager,
unsigned int &  num_queues 
) [inline, static]
template<typename TaskMgr >
static void pfunc::get_num_threads ( const TaskMgr &  tmanager,
unsigned int &  num_threads 
) [inline, static]
static void pfunc::group_barrier_get ( const group &  grp,
unsigned int &  barr 
) [inline, static]
Parameters:
[in]grpGroup whose barrier type is to be retrieved.
[out]barrBarrier type of the group.
static void pfunc::group_barrier_set ( group &  grp,
const unsigned int &  barr 
) [inline, static]
Parameters:
[out]grpGroup whose Barrier type is to be set.
[in]barrBarrier type of the group.
static void pfunc::group_id_get ( const group &  grp,
unsigned int &  id 
) [inline, static]
Parameters:
[in]grpGroup whose ID is to be retrieved.
[out]idID of the group.
static void pfunc::group_id_set ( group &  grp,
const unsigned int &  id 
) [inline, static]
Parameters:
[out]grpGroup whose ID is to be set.
[in]idID of the group.
template<typename TaskManager >
static void pfunc::group_rank ( const TaskManager &  tmanager,
unsigned int &  rank 
) [inline, static]
Parameters:
[in]tmanagerThe task manager which is running the current task.
[out]rankRank of the task in the group.
template<typename TaskManager >
static void pfunc::group_size ( const TaskManager &  tmanager,
unsigned int &  size 
) [inline, static]
Parameters:
[in]tmanagerThe task manager which is running the current task.
[out]sizeSize of the group in which the task is a part of.
static void pfunc::group_size_get ( const group &  grp,
unsigned int &  size 
) [inline, static]
Parameters:
[in]grpGroup whose size is to be retrieved.
[out]sizeSize of the group.
static void pfunc::group_size_set ( group &  grp,
const unsigned int &  size 
) [inline, static]
Parameters:
[out]grpGroup whose size is to be retrieved.
[in]sizeSize of the group.
template<typename TaskManager >
static void pfunc::spawn ( TaskManager &  tmanager,
typename TaskManager::task &  task,
const typename TaskManager::attribute &  attr,
group &  grp,
typename TaskManager::functor &  func 
) [inline, static]

Spawn the task specified. The specification consists of a task, the task attributes, the group the task belongs to and the functor that executes the task.

Parameters:
[in]tmanagerThe task manager that is running the tasks.
[out]taskTask to the task we are adding.
[in]attrAttributes with which to create this job.
[in,out]grpGroup that contains the group of these tasks.
[in]funcThe work function to execute
template<typename TaskManager >
static void pfunc::spawn ( TaskManager &  tmanager,
typename TaskManager::task &  task,
typename TaskManager::functor &  func 
) [inline, static]

Spawn the task specified. The specification consists of a task, the task attributes, the group the task belongs to and the functor that executes the task.

Parameters:
[in]tmanagerThe task manager that is running the tasks.
[out]taskTask to the task we are adding.
[in]funcThe work function to execute
template<typename TaskManager >
static void pfunc::spawn ( TaskManager &  tmanager,
typename TaskManager::task &  task,
const typename TaskManager::attribute &  attr,
typename TaskManager::functor &  func 
) [inline, static]

Spawn the task specified. The specification consists of a task, the task attributes, the group the task belongs to and the functor that executes the task.

Parameters:
[in]tmanagerThe task manager that is running the tasks.
[out]taskTask to the task we are adding.
[in]attrAttributes with which to create this job.
[in]funcThe work function to execute
template<typename TaskManager >
static void pfunc::taskmgr_max_attempts_get ( TaskManager &  tmanager,
unsigned int &  attempts 
) [inline, static]
template<typename TaskManager >
static void pfunc::taskmgr_max_attempts_set ( TaskManager &  tmanager,
const unsigned int &  attempts 
) [inline, static]
template<typename TaskManager , typename TaskType >
static bool pfunc::test ( TaskManager &  tmanager,
TaskType &  task 
) [inline, static]

Test for completion of the task associated with the task

Parameters:
[in]tmanagerThe task manager that is running the tasks.
[in,out]taskTask to be tested for completion.
Returns:
True if the task completed, false otherwise.
template<typename TaskManager , typename ForwardIterator >
static bool pfunc::test_all ( TaskManager &  tmanager,
ForwardIterator  first,
ForwardIterator  last,
int *  completion_arr 
) [inline, static]

Test for completion of the tasks specified by the set of tasks.

Parameters:
[in]tmanagerThe task manager that is running the tasks.
[in]firstFirst of the tasks to be tested on.
[in]lastEnd marker for the tasks to be tested on (true last+1).
[out]completion_arrContains the results of the tests.
template<typename TaskManager >
static unsigned int pfunc::thread_id ( const TaskManager &  tmanager) [inline, static]

Retrieves the ID of the currently executing thread.

Parameters:
[in]tmanagerTaskManager that is currently running the threads.
template<typename TaskManager , typename TaskType >
static void pfunc::wait ( TaskManager &  tmanager,
TaskType *  task 
) [inline, static]
Parameters:
[in]taskmgrThe taskmanager that is running the task.
[in,out]taskThe task to be waited on.
template<typename TaskManager , typename TaskType >
static void pfunc::wait ( TaskManager &  tmanager,
TaskType &  task 
) [inline, static]
Parameters:
[in]taskmgrThe taskmanager that is running the task.
[in,out]taskThe task to be waited on.
template<typename TaskManager , typename ForwardIterator >
static void pfunc::wait_all ( TaskManager &  tmanager,
ForwardIterator  first,
ForwardIterator  last 
) [inline, static]

Waits for all the tasks in the specified set to complete.

Parameters:
[in]tmanagerThe task manager that is running the tasks.
[in]firstStart marker of the tasks to be waited on
[in]lastEnd marker for the tasks to be waited on (true last+1)
template<typename TaskManager , typename ForwardIterator >
static void pfunc::wait_any ( TaskManager &  tmanager,
ForwardIterator  first,
ForwardIterator  last,
int *  completion_arr 
) [inline, static]

Waits for one of the tasks specified in the set. The algorithm implemented is one of test_all () followed by exponential backoff.

Parameters:
[in]tmanagerThe task manager that is running the tasks.
[in]firstFirst of the tasks to be waited on.
[in]lastEnd marker for the tasks to be waited on (true last+1).
[out]completion_arrArray that contains the completion status.

Exponential backoff can be implemented using "pause" command that both Intel and AMD architectures provide. That being said, we want to not including any architecture specific code. Quite the quandry :-/. Note that on WINDOWS, we are not doing an exponential backoff since the minimum resolution of the Sleep() function is 1 MilliSecond. So, we always sleep for that amount of time since its quite large.