Start a process pool.
Returns a PoolMaster object for the master node. Slave nodes are run and then optionally killed.
If you elect not to kill the slaves, note that they will emerge at the point this function was called, which is likely very different from the point the master is at, so it will likely be necessary to put in some rank dependent code (e.g., look at the 'rank' attribute of the returned pools).
Note that the pool objects should be deleted (either by going out of scope or explicit 'del') before program termination to avoid a segmentation fault.
- Parameters
-
comm | MPI communicator |
root | Rank of root/master node |
killSlaves | Kill slaves on completion? |
Definition at line 1216 of file pool.py.
1216 def startPool(comm=None, root=0, killSlaves=True):
1217 """!Start a process pool.
1219 Returns a PoolMaster object for the master node.
1220 Slave nodes are run and then optionally killed.
1222 If you elect not to kill the slaves, note that they
1223 will emerge at the point this function was called,
1224 which is likely very different from the point the
1225 master is at, so it will likely be necessary to put
1226 in some rank dependent code (e.g., look at the 'rank'
1227 attribute of the returned pools).
1229 Note that the pool objects should be deleted (either
1230 by going out of scope or explicit 'del') before program
1231 termination to avoid a segmentation fault.
1233 @param comm: MPI communicator
1234 @param root: Rank of root/master node
1235 @param killSlaves: Kill slaves on completion?
1239 if comm.rank == root:
1240 return PoolMaster(comm, root=root)
1241 slave = PoolSlave(comm, root=root)