Start a process pool.
Process Pool
Use this class to automatically provide 'context' to
the PoolMaster class. If you want to call functions
that don't take a 'cache' object, use the PoolMaster
class directly, and specify context=None.
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 1217 of file pool.py.
1217 def startPool(comm=None, root=0, killSlaves=True):
1218 """!Start a process pool. 1220 Returns a PoolMaster object for the master node. 1221 Slave nodes are run and then optionally killed. 1223 If you elect not to kill the slaves, note that they 1224 will emerge at the point this function was called, 1225 which is likely very different from the point the 1226 master is at, so it will likely be necessary to put 1227 in some rank dependent code (e.g., look at the 'rank' 1228 attribute of the returned pools). 1230 Note that the pool objects should be deleted (either 1231 by going out of scope or explicit 'del') before program 1232 termination to avoid a segmentation fault. 1234 @param comm: MPI communicator 1235 @param root: Rank of root/master node 1236 @param killSlaves: Kill slaves on completion? 1240 if comm.rank == root:
1241 return PoolMaster(comm, root=root)
1242 slave = PoolSlave(comm, root=root)
1248 def startPool(comm=None, root=0, killSlaves=True)
Start a process pool.