XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
TaskGroup Class Reference

A class that manages the distribution and execution of tasks in parallel using the MPI library. The TaskGroup class is responsible for managing the distribution and execution of tasks in parallel across multiple MPI processes. It provides methods for determining the number of tasks to be executed by each process, as well as methods for executing and communicating task-related data between processes. More...

#include <task_group.hpp>

Public Member Functions

 TaskGroup ()
 Default constructor for the TaskGroup class. More...
 
int get_my_rank () const
 Get the rank of the current process within the MPI communicator. More...
 
int get_n_local_tasks (int n_tasks) const
 Calculate the number of tasks assigned to the current process. More...
 
int get_max_n_local_tasks (int n_tasks) const
 Calculate the maximum number of tasks assigned to any process. More...
 
template<typename F >
void execute_task (int ntasks, F func) const
 Execute the given task function for each assigned task. More...
 

Private Attributes

int my_rank
 The rank of the current process within the MPI communicator. More...
 
int n_ranks
 The total number of processes within the MPI communicator. More...
 

Detailed Description

A class that manages the distribution and execution of tasks in parallel using the MPI library. The TaskGroup class is responsible for managing the distribution and execution of tasks in parallel across multiple MPI processes. It provides methods for determining the number of tasks to be executed by each process, as well as methods for executing and communicating task-related data between processes.

Constructor & Destructor Documentation

TaskGroup::TaskGroup ( )
inline

Default constructor for the TaskGroup class.

Member Function Documentation

template<typename F >
void TaskGroup::execute_task ( int  ntasks,
func 
) const
inline

Execute the given task function for each assigned task.

Template Parameters
FThe type of the task function to be executed.
Parameters
[in]ntasksThe total number of tasks to be distributed across all processes.
[in]funcThe task function to be executed for each assigned task.

Here is the caller graph for this function:

int TaskGroup::get_max_n_local_tasks ( int  n_tasks) const
inline

Calculate the maximum number of tasks assigned to any process.

Parameters
[in]n_tasksThe total number of tasks to be distributed across all processes.
Returns
The maximum number of tasks assigned to any process.

Here is the caller graph for this function:

int TaskGroup::get_my_rank ( ) const
inline

Get the rank of the current process within the MPI communicator.

Returns
The rank of the current process.

Here is the caller graph for this function:

int TaskGroup::get_n_local_tasks ( int  n_tasks) const
inline

Calculate the number of tasks assigned to the current process.

Parameters
[in]n_tasksThe total number of tasks to be distributed across all processes.
Returns
The number of tasks assigned to the current process.

Here is the caller graph for this function:

Member Data Documentation

int TaskGroup::my_rank
private

The rank of the current process within the MPI communicator.

int TaskGroup::n_ranks
private

The total number of processes within the MPI communicator.


The documentation for this class was generated from the following file: