bodo.random_shuffle¶
bodo.random_shuffle(data, seed=None, dests=None, parallel=False)
Manually shuffle data evenly across selected ranks.
Arguments¶
data
: data to shuffle.seed
: number to initialze random number generator.dests
: selected ranks to distribute shuffled data to. By default, distribution includes all ranks.parallel
: flag to indicate whether data is distributed. Default:False
. Inside JIT default value depends on Bodo's distribution analysis algorithm for the data passed (For more information, see Data Distribution section below).
Example Usage¶
Note that this example uses SPMD launch mode.
import bodo
import pandas as pd
@bodo.jit(spawn=False)
def test_random_shuffle():
df = pd.DataFrame({"A": range(100)})
return df
df = test_random_shuffle()
print(df.head())
df = bodo.random_shuffle(res, parallel=True)
print(df.head())
Save code in test_random_shuffle.py
file and run with mpiexec
.
Output: