INGOR
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ytJob Class Reference

Job distribution utility routines. More...

#include <util/ytJob.h>

Public Member Functions

div_t ytJob_split (int total, int procs, int rank, int *start, int *size)
 Splits jobs evenly and returns the start index and the size for the process.
 
div_t ytJob_splitMax (int total, int procs, int rank, int *start, int *size, int *maxSize)
 Splits jobs evenly.
 
div_t ytJob_splitBlock (int total, int procs, int rank, int *start, int *size, int *maxSize)
 Splits jobs evenly and returns the start index and the size for a process.
 

Detailed Description

Job distribution utility routines.


ytLib Programming API Document

Member Function Documentation

◆ ytJob_split()

div_t ytJob_split ( int  total,
int  procs,
int  rank,
int *  start,
int *  size 
)

Splits jobs evenly and returns the start index and the size for the process.

This routine calculates the start index (position) and the size of the jobs for the process indicated by argument rank if total jobs are given. The jobs are split into equal sizes as much as possible for procs processes.

More exactly, this splits total jobs into x + 1 jobs to y processes, and x jobs to total - y processes. Here x and y are returned as a value of div_t. Member quot (rem) has x (y).

The calculated start index and the size are set to arguments start and size.

This can be also used for cyclic separation of data. In such a case, however, the returned value in start has no meaning. start can be NULL for such a case.

Parameters
total
procs
rank
startNULL acceptable.
size

◆ ytJob_splitBlock()

div_t ytJob_splitBlock ( int  total,
int  procs,
int  rank,
int *  start,
int *  size,
int *  maxSize 
)

Splits jobs evenly and returns the start index and the size for a process.

Unlike ytJob_split(), this splits the total jobs into the same size of blocks. The returned size for the last rank is in [0, maxSize - 1]. Note that, there can be exist processes where no tasks are assigned.

Parameters
[in]total
[in]procs
[in]rank
[out]start
[out]size
[out]maxSize

◆ ytJob_splitMax()

div_t ytJob_splitMax ( int  total,
int  procs,
int  rank,
int *  start,
int *  size,
int *  maxSize 
)

Splits jobs evenly.

This is the same as ytJob_split() except that this also returns the maximum job size among all the processes. This is useful if you need to repeat the same number of the process.

Parameters
[out]maxSizeMaximum size among all the processes.

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