aarongarrett / inspyred

Python library for bio-inspired computational intelligence
MIT License
187 stars 58 forks source link

An example of MPI parallelization for inspyred #17

Closed rat-h closed 12 months ago

rat-h commented 5 years ago

Here an example of how to make a parallel evaluator using mpi4py module. Note that a number of individuals to be selected or/and offspring size must be equal or bigger than size of the MPI world. The example also shows how to pass args and candidates to the MPI workers. Note that only master node (rank = 0) perform evolutionary computation, everyone else, just stuck in parallel_evaluation_mpi function until master node sends "mpi_stop" key in args. On small clusters where memory size and other resources are limited, one can bypass initialization of ec on workers and call parallel_evaluation_mpi instead of main()