import numpy as np import Starfish from Starfish import parallel from Starfish.parallel import args from Starfish.model import ThetaParam, PhiParam print("THIS IS WORKING") if args.generate: model = parallel.OptimizeTheta(debug=True) # Now that the different processes have been forked, initialize them pconns, cconns, ps = parallel.initialize(model) pars = ThetaParam.from_dict(Starfish.config["Theta"]) for ((spectrum_id, order_id), pconn) in pconns.items(): #Parse the parameters into what needs to be sent to each Model here. pconn.send(("LNPROB", pars)) pconn.recv() # Receive and discard the answer so we can send the save pconn.send(("SAVE", None)) # Kill all of the orders for pconn in pconns.values(): pconn.send(("FINISH", None)) pconn.send(("DIE", None)) # Join on everything and terminate for p in ps.values(): p.join()
# All of the argument parsing is done in the `parallel.py` module. import numpy as np import Starfish from Starfish import parallel_linear from Starfish.parallel_linear import args from Starfish.model import ThetaParam, PhiParam if args.generate: model = parallel_linear.OptimizeTheta(debug=True) # Now that the different processes have been forked, initialize them pconns, cconns, ps = parallel_linear.initialize(model) pars = ThetaParam.from_dict(Starfish.config["Theta"]) for ((spectrum_id, order_id), pconn) in pconns.items(): #Parse the parameters into what needs to be sent to each Model here. pconn.send(("LNPROB", pars)) pconn.recv() # Receive and discard the answer so we can send the save pconn.send(("SAVE", None)) # Kill all of the orders for pconn in pconns.values(): pconn.send(("FINISH", None)) pconn.send(("DIE", None)) # Join on everything and terminate for p in ps.values(): p.join()