PFUNC
1.0
|
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) |
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 int pfunc::error_code_type |
Type of the error code
static void pfunc::attr_grouped_get | ( | const Attribute & | attr, |
typename Attribute::grouped_type & | grouped | ||
) | [inline, static] |
[in] | attr | Attribute whose grouped nature is to be retrieved. |
[out] | grouped | Determines the if the attribute is grouped. |
static void pfunc::attr_grouped_set | ( | Attribute & | attr, |
const typename Attribute::grouped_type & | grouped | ||
) | [inline, static] |
[out] | attr | Attribute whose group is to be set/unset. |
[in] | grouped | Determines the if the attribute is grouped. |
static void pfunc::attr_level_get | ( | Attribute & | attr, |
typename Attribute::level_type & | level | ||
) | [inline, static] |
[out] | attr | Attribute whose level is to be retrieved. |
[in] | level | Level the attribute. |
static void pfunc::attr_level_set | ( | Attribute & | attr, |
const typename Attribute::level_type & | level | ||
) | [inline, static] |
[out] | attr | Attribute whose level is to be set. |
[in] | level | Level the attribute. |
static void pfunc::attr_nested_get | ( | const Attribute & | attr, |
typename Attribute::nested_type & | nested | ||
) | [inline, static] |
[in] | attr | Attribute whose nestedness is to be retrieved. |
[out] | nested | Nestedness for the given attribute. |
static void pfunc::attr_nested_set | ( | Attribute & | attr, |
const typename Attribute::nested_type & | nested | ||
) | [inline, static] |
[out] | attr | Attribute whose nestedness is to be set. |
[in] | nested | Nestedness of the attribute. |
static void pfunc::attr_num_waiters_get | ( | const Attribute & | attr, |
typename Attribute::num_waiters_type & | nwait | ||
) | [inline, static] |
[in] | attr | Attribute whose number of waiters is to be retrieved. |
[out] | nwait | Number of waiters for the given attribute. |
static void pfunc::attr_num_waiters_set | ( | Attribute & | attr, |
const typename Attribute::num_waiters_type & | nwait | ||
) | [inline, static] |
[out] | attr | Attribute whose number of waiters is to be set |
[in] | nwait | Number of waiters for the attribute. |
static void pfunc::attr_priority_get | ( | const Attribute & | attr, |
typename Attribute::priority_type & | pri | ||
) | [inline, static] |
[in] | attr | Attribute whose priority is to be retrieved |
[out] | pri | Priority for the given attribute |
static void pfunc::attr_priority_set | ( | Attribute & | attr, |
const typename Attribute::priority_type & | pri | ||
) | [inline, static] |
[out] | attr | Attribute whose priority is to be set |
[in] | pri | Priority for the attribute |
static void pfunc::attr_qnum_get | ( | const Attribute & | attr, |
typename Attribute::qnum_type & | qnum | ||
) | [inline, static] |
[in] | attr | Attribute whose queue number is to be retrieved |
[out] | qnum | Queue number for the given attribute |
static void pfunc::attr_qnum_set | ( | Attribute & | attr, |
const typename Attribute::qnum_type & | qnum | ||
) | [inline, static] |
[out] | attr | Attribute whose queue number is to be set |
[in] | qnum | Queue number for the attribute. |
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.
[in] | tmanager | The task manager that is running the tasks. |
static void pfunc::get_num_queues | ( | const TaskMgr & | tmanager, |
unsigned int & | num_queues | ||
) | [inline, static] |
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] |
[in] | grp | Group whose barrier type is to be retrieved. |
[out] | barr | Barrier type of the group. |
static void pfunc::group_barrier_set | ( | group & | grp, |
const unsigned int & | barr | ||
) | [inline, static] |
[out] | grp | Group whose Barrier type is to be set. |
[in] | barr | Barrier type of the group. |
static void pfunc::group_id_get | ( | const group & | grp, |
unsigned int & | id | ||
) | [inline, static] |
[in] | grp | Group whose ID is to be retrieved. |
[out] | id | ID of the group. |
static void pfunc::group_id_set | ( | group & | grp, |
const unsigned int & | id | ||
) | [inline, static] |
[out] | grp | Group whose ID is to be set. |
[in] | id | ID of the group. |
static void pfunc::group_rank | ( | const TaskManager & | tmanager, |
unsigned int & | rank | ||
) | [inline, static] |
[in] | tmanager | The task manager which is running the current task. |
[out] | rank | Rank of the task in the group. |
static void pfunc::group_size | ( | const TaskManager & | tmanager, |
unsigned int & | size | ||
) | [inline, static] |
[in] | tmanager | The task manager which is running the current task. |
[out] | size | Size 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] |
[in] | grp | Group whose size is to be retrieved. |
[out] | size | Size of the group. |
static void pfunc::group_size_set | ( | group & | grp, |
const unsigned int & | size | ||
) | [inline, static] |
[out] | grp | Group whose size is to be retrieved. |
[in] | size | Size of the group. |
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.
[in] | tmanager | The task manager that is running the tasks. |
[out] | task | Task to the task we are adding. |
[in] | attr | Attributes with which to create this job. |
[in,out] | grp | Group that contains the group of these tasks. |
[in] | func | The work function to execute |
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.
[in] | tmanager | The task manager that is running the tasks. |
[out] | task | Task to the task we are adding. |
[in] | func | The work function to execute |
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.
[in] | tmanager | The task manager that is running the tasks. |
[out] | task | Task to the task we are adding. |
[in] | attr | Attributes with which to create this job. |
[in] | func | The work function to execute |
static void pfunc::taskmgr_max_attempts_get | ( | TaskManager & | tmanager, |
unsigned int & | attempts | ||
) | [inline, static] |
static void pfunc::taskmgr_max_attempts_set | ( | TaskManager & | tmanager, |
const unsigned int & | attempts | ||
) | [inline, static] |
static bool pfunc::test | ( | TaskManager & | tmanager, |
TaskType & | task | ||
) | [inline, static] |
Test for completion of the task associated with the task
[in] | tmanager | The task manager that is running the tasks. |
[in,out] | task | Task to be tested for completion. |
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.
[in] | tmanager | The task manager that is running the tasks. |
[in] | first | First of the tasks to be tested on. |
[in] | last | End marker for the tasks to be tested on (true last+1). |
[out] | completion_arr | Contains the results of the tests. |
static unsigned int pfunc::thread_id | ( | const TaskManager & | tmanager | ) | [inline, static] |
Retrieves the ID of the currently executing thread.
[in] | tmanager | TaskManager that is currently running the threads. |
static void pfunc::wait | ( | TaskManager & | tmanager, |
TaskType * | task | ||
) | [inline, static] |
[in] | taskmgr | The taskmanager that is running the task. |
[in,out] | task | The task to be waited on. |
static void pfunc::wait | ( | TaskManager & | tmanager, |
TaskType & | task | ||
) | [inline, static] |
[in] | taskmgr | The taskmanager that is running the task. |
[in,out] | task | The task to be waited on. |
static void pfunc::wait_all | ( | TaskManager & | tmanager, |
ForwardIterator | first, | ||
ForwardIterator | last | ||
) | [inline, static] |
Waits for all the tasks in the specified set to complete.
[in] | tmanager | The task manager that is running the tasks. |
[in] | first | Start marker of the tasks to be waited on |
[in] | last | End marker for the tasks to be waited on (true last+1) |
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.
[in] | tmanager | The task manager that is running the tasks. |
[in] | first | First of the tasks to be waited on. |
[in] | last | End marker for the tasks to be waited on (true last+1). |
[out] | completion_arr | Array 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.