@@ -154,40 +154,8 @@ def factory(
154154 logger .error (f"Could not create an algorithm with name { algorithm_name } " )
155155 raise SystemExit (1 ) from e
156156
157- def _update_distributions_and_statistics (self , distributions : dict , statistics : dict ):
158- """Compute and update run distributions and statistics."""
159- # Create or update distributions of object quantities of interest
160- for object_qoi_name in tuple ({"load" , self .__object_qoi }):
161- if not object_qoi_name :
162- continue
163- try :
164- distributions .setdefault (f"object { object_qoi_name } " , []).append (
165- {o .get_id (): getattr (o , f"get_{ object_qoi_name } " )()
166- for o in self ._rebalanced_phase .get_objects ()})
167- except AttributeError as err :
168- self .__print_QOI ("obj" )
169- self ._logger .error (f"Invalid object_qoi name '{ object_qoi_name } '" )
170- raise SystemExit (1 ) from err
171-
172- # Create or update distributions of rank quantities of interest
173- for rank_qoi_name in tuple ({"objects" , "load" , self .__rank_qoi }):
174- if not rank_qoi_name or rank_qoi_name == "work" :
175- continue
176- try :
177- distributions .setdefault (f"rank { rank_qoi_name } " , []).append (
178- [getattr (p , f"get_{ rank_qoi_name } " )()
179- for p in self ._rebalanced_phase .get_ranks ()])
180- except AttributeError as err :
181- self .__print_QOI ("rank" )
182- self ._logger .error (f"Invalid rank_qoi name '{ rank_qoi_name } '" )
183- raise SystemExit (1 ) from err
184- distributions .setdefault ("rank work" , []).append (
185- [self ._work_model .compute (p ) for p in self ._rebalanced_phase .get_ranks ()])
186-
187- # Create or update distributions of edge quantities of interest
188- distributions .setdefault ("sent" , []).append (dict (
189- self ._rebalanced_phase .get_edge_maxima ().items ()))
190-
157+ def _update_statistics (self , statistics : dict ):
158+ """Compute and update run statistics."""
191159 # Create or update statistics dictionary entries
192160 for (support , getter ), stat_names in self .__statistics .items ():
193161 for k , v in stat_names .items ():
@@ -253,7 +221,7 @@ def _report_final_mapping(self, logger):
253221 logger .debug (
254222 f"object { k .get_id ()} on rank { k .get_rank_id ()} : { v } " )
255223
256- def _initialize (self , p_id , phases , distributions , statistics ):
224+ def _initialize (self , p_id , phases , statistics ):
257225 """Factor out pre-execution checks and initalizations."""
258226 # Ensure that a list with at least one phase was provided
259227 if not isinstance (phases , dict ) or not all (
@@ -286,16 +254,15 @@ def _initialize(self, p_id, phases, distributions, statistics):
286254 f"across { self ._rebalanced_phase .get_number_of_ranks ()} ranks "
287255 f"into phase { self ._rebalanced_phase .get_id ()} " )
288256
289- # Initialize run distributions and statistics
290- self ._update_distributions_and_statistics ( distributions , statistics )
257+ # Initialize run statistics
258+ self ._update_statistics ( statistics )
291259
292260 @abc .abstractmethod
293- def execute (self , p_id , phases , distributions , statistics , a_min_max ):
261+ def execute (self , p_id , phases , statistics , a_min_max ):
294262 """Execute balancing algorithm on Phase instance.
295263
296264 :param: p_id: index of phase to be rebalanced (all if equal to _)
297265 :param: phases: list of Phase instances
298- :param: distributions: dictionary of load-varying variables
299266 :param: statistics: dictionary of statistics
300267 :param: a_min_max: possibly empty list of optimal arrangements.
301268 """
0 commit comments