|
2 | 2 | import mpisppy.utils.sputils as sputils
|
3 | 3 | import pyomo.environ as pyo
|
4 | 4 | import mpisppy
|
| 5 | +from mpisppy import MPI |
| 6 | +global_rank = MPI.COMM_WORLD.Get_rank() |
5 | 7 |
|
6 | 8 | def _consensus_vars_number_creator(consensus_vars):
|
7 | 9 | """associates to each consensus vars the number of time it appears
|
@@ -65,7 +67,8 @@ def __init__(self,
|
65 | 67 | scenario_names_to_rank, _rank_slices, _scenario_slices =\
|
66 | 68 | scenario_tree.scen_names_to_ranks(ranks_per_cylinder)
|
67 | 69 |
|
68 |
| - self.cylinder_rank = mpicomm.Get_rank() % ranks_per_cylinder |
| 70 | + self.cylinder_rank = mpicomm.Get_rank() // n_cylinders |
| 71 | + #self.cylinder_rank = mpicomm.Get_rank() % ranks_per_cylinder |
69 | 72 | self.all_scenario_names = all_scenario_names
|
70 | 73 | #taken from spbase
|
71 | 74 | self.local_scenario_names = [
|
@@ -149,7 +152,9 @@ def assign_variable_probs(self, verbose=False):
|
149 | 152 |
|
150 | 153 |
|
151 | 154 | def admm_ph_scenario_creator(self, sname):
|
152 |
| - #this is the function the user will supply for all cylinders |
| 155 | + #this is the function the user will supply for all cylinders |
| 156 | + assert sname in self.local_scenario_names, f"{global_rank=} {sname=} \n {self.local_scenario_names=}" |
| 157 | + #should probably be deleted as it takes time |
153 | 158 | scenario = self.local_scenarios[sname]
|
154 | 159 |
|
155 | 160 | # Grabs the objective function and multiplies its value by the number of scenarios to compensate for the probabilities
|
|
0 commit comments