mbtrack2.tracking.parallel module¶
Module to handle parallel computation
- class Mpi(filling_pattern: ndarray[tuple[int, ...], dtype[_ScalarType_co]])[source]¶
Bases:
objectClass which handle parallel computation via the mpi4py module [1].
Parameters¶
- filling_patternbool array of shape (h,)
Filling pattern of the beam, like Beam.filling_pattern
Attributes¶
- commMPI.Intracomm object
MPI intra-comminicator of the processor group, used to manage communication between processors.
- rankint
Rank of the processor which run the program
- sizeint
Number of processor within the processor group (in fact in the intra-comminicator group)
- tableint array of shape (size, 2)
Table of correspondance between the rank of the processor and its associated bunch number
- bunch_numint
Return the bunch number corresponding to the current processor
- next_bunchint
Return the rank of the next tracked bunch
- previous_bunchint
Return the rank of the previous tracked bunch
Methods¶
- write_table(filling_pattern)
Write a table with the rank and the corresponding bunch number for each bunch of the filling pattern
- rank_to_bunch(rank)
Return the bunch number corresponding to rank
- bunch_to_rank(bunch_num)
Return the rank corresponding to the bunch number bunch_num
- share_distributions(beam)
Compute the bunch profiles and share it between the different bunches.
- share_means(beam)
Compute the bunch means and share it between the different bunches.
- share_stds(beam)
Compute the bunch standard deviations and share it between the different bunches.
References¶
[1] L. Dalcin, P. Kler, R. Paz, and A. Cosimo, Parallel Distributed Computing using Python, Advances in Water Resources, 34(9):1124-1139, 2011.
- write_table(filling_pattern: ndarray[tuple[int, ...], dtype[_ScalarType_co]])[source]¶
Write a table with the rank and the corresponding bunch number for each bunch of the filling pattern
Parameters¶
- filling_patternbool array of shape (h,)
Filling pattern of the beam, like Beam.filling_pattern
- rank_to_bunch(rank: int) int[source]¶
Return the bunch number corresponding to rank
Parameters¶
- rankint
Rank of a processor
Returns¶
- bunch_numint
Bunch number corresponding to the input rank
- bunch_to_rank(bunch_num: int) int[source]¶
Return the rank corresponding to the bunch number bunch_num
Parameters¶
- bunch_numint
Bunch number
Returns¶
- rankint
Rank of the processor which tracks the input bunch number
- property bunch_num: int¶
Return the bunch number corresponding to the current processor
- property next_bunch: int¶
Return the rank of the next tracked bunch
- property previous_bunch: int¶
Return the rank of the previous tracked bunch
Compute the bunch profiles and share it between the different bunches.
Parameters¶
beam : Beam object dimension : str or list of str, optional
Dimensions in which the binning is done. The default is “tau”.
- n_binint or list of int, optional
Number of bins. The default is 75.
Compute the bunch means and share it between the different bunches.
Parameters¶
beam : Beam object
Compute the bunch standard deviations and share it between the different bunches.
Parameters¶
beam : Beam object