gaft.mpiutil

A high-level utility class for parallelizing Genetic Algorithm by using MPI interfaces in distributed MPI environment.

gaft.mpiutil.master_only(func)

Decorator to limit a function to be called only in master process in MPI env.

class gaft.mpiutil.MPIUtil
barrier()

Block until all processes in the communicator have reached this routine

bcast(data)

Broadcast data to MPI processes

Parameters:data (any Python object) – Data to be broadcasted
is_master

If current process is the master process

merge_seq(seq)

Gather data in sub-process to root process.

Parameters:seq (any Python object list) – Sub data sequence for current process
Returns:Merged data sequence from all processes in a communicator
Return type:any Python object list
rank

Get the rank of the calling process in the communicator

size

Get the size of the group associated with a communicator

split_seq(sequence)

Split the sequence according to rank and processor number.

Parameters:sequence (any Python object list) – Data sequence to be splitted
Returns:Sub data sequence for current process
Return type:any Python object list
split_size(size)

Split a size number(int) to sub-size number.

Parameters:size (int) – The size number to be splitted.
Returns:Sub-size for current process
Return type:int