qimpy.mpi.TaskDivision

class TaskDivision(*, n_tot, n_procs, i_proc, name=None)

Bases: object

Division of a number of tasks over MPI.

Parameters:
  • n_tot (int) –

  • n_procs (int) –

  • i_proc (int) –

  • name (str | None) –

__init__(*, n_tot, n_procs, i_proc, name=None)

Divide n_tot tasks among n_procs processes. Report division and load balance if name is not None.

Parameters:
  • n_tot (int) –

  • n_procs (int) –

  • i_proc (int) –

  • name (str | None) –

Return type:

None

Methods

__init__

Divide n_tot tasks among n_procs processes.

is_mine

Return whether current process is responsible for task i

whose

Return process index i_proc responsible for task i

whose_each

Return process index i_proc responsible for each task in i

Attributes

n_tot

Total number of tasks over all processes

n_procs

Number of processes to split over

i_proc

Rank of current process

n_each

Number of tasks on each process (till we run out)

n_prev

Cumulative task counts (n_procs+1 ints)

i_start

Task start index on current process

i_stop

Task stop index on current process

n_mine

Number of tasks on current process

is_mine(i)

Return whether current process is responsible for task i

Parameters:

i (int) –

Return type:

bool

whose(i)

Return process index i_proc responsible for task i

Parameters:

i (int) –

Return type:

int

whose_each(i)

Return process index i_proc responsible for each task in i

Parameters:

i (Tensor) –

Return type:

Tensor

i_proc: int

Rank of current process

i_start: int

Task start index on current process

i_stop: int

Task stop index on current process

n_each: int

Number of tasks on each process (till we run out)

n_mine: int

Number of tasks on current process

n_prev: ndarray

Cumulative task counts (n_procs+1 ints)

n_procs: int

Number of processes to split over

n_tot: int

Total number of tasks over all processes