Partitioning a DataSet
When reading a dataset with multiple MPI ranks, the dataset must be partitioned amongst the ranks. Given the length of the dataset and the number of MPI ranks, partitionDS
will determine start and end indices for each MPI rank such that the number of elements per rank are as equal as possible.
Note that partitionDS
is really a wrapper around Distributed.splitrange.
julia> using IRMA
julia> partitionDS(1_000_000, 64)
64-element Array{UnitRange{Int64},1}:
1:15625
15626:31250
31251:46875
46876:62500
62501:78125
78126:93750
93751:109375
109376:125000
125001:140625
140626:156250
⋮
859376:875000
875001:890625
890626:906250
906251:921875
921876:937500
937501:953125
953126:968750
968751:984375
984376:1000000
See an example Pluto Notebook and a static version.