diff --git a/wc_sim/dynamic_components.py b/wc_sim/dynamic_components.py index fd163d5f..9dc2845c 100644 --- a/wc_sim/dynamic_components.py +++ b/wc_sim/dynamic_components.py @@ -729,7 +729,7 @@ class DynamicModel(object): that get repeated rxn_expression_dependencies (:obj:`dict`): map from reactions to lists of expressions whose values depend on species with non-zero stoichiometry in the reaction - # TODO: OPTIMIZE DFBA CACHING: describe dFBA caching optimization + # TODO (APG): OPTIMIZE DFBA CACHING: describe dFBA caching optimization continuous_rxn_dependencies (:obj:`dict`): map from ids of continuous submodels to sets identifying expressions whose values depend on species with non-zero stoichiometry in reaction(s) modeled by the submodel @@ -999,13 +999,14 @@ def obtain_dependencies(self, model): model. If a simulation fails with the error "killed" and no other information, then it is probably running on a system or in a container which does not have sufficient memory to complete - this function. Try running on a system with more memory or simulating a smaller model. + this function. Try running on a system with more memory, simulating a smaller model, or + disabling caching in `wc_sim.cfg`. Args: model (:obj:`Model`): the description of the whole-cell model in `wc_lang` Returns: - :obj:`dict` of :obj:`list`: the dependencies of expressions on reactions, as a map from + :obj:`dict` of :obj:`list`: the dependencies of expressions on reactions, which maps each reaction to a list of expressions """ used_model_types = set((wc_lang.Function, @@ -1111,7 +1112,7 @@ def continuous_reaction_dependencies(self): continuous_rxn_dependencies = {} for submodel_id, sm_reactions in rxns_modeled_by_continuous_submodels.items(): continuous_rxn_dependencies[submodel_id] = set() - # TODO: OPTIMIZE DFBA CACHING: only include exchange and objective (biomass) reactions in dFBA submodels + # TODO (APG): OPTIMIZE DFBA CACHING: only include exchange and objective (biomass) reactions in dFBA submodels for reaction, dependencies in self.rxn_expression_dependencies.items(): if reaction in sm_reactions: continuous_rxn_dependencies[submodel_id].update(dependencies) @@ -1173,11 +1174,6 @@ def continuous_submodel_flush_after_populations_change(self, dynamic_submodel_id Args: dynamic_submodel_id (:obj:`str`): the id of the continuous submodel that's running """ - ''' - print('continuous_submodel_flush_after_populations_change') - print('dynamic_submodel_id', dynamic_submodel_id) - print('self.continuous_rxn_dependencies[dynamic_submodel_id]', self.continuous_rxn_dependencies[dynamic_submodel_id]) - ''' self.cache_manager.invalidate(expressions=self.continuous_rxn_dependencies[dynamic_submodel_id]) self.flush_compartment_masses() diff --git a/wc_sim/submodels/dfba.py b/wc_sim/submodels/dfba.py index 51923f56..225c55b5 100644 --- a/wc_sim/submodels/dfba.py +++ b/wc_sim/submodels/dfba.py @@ -480,7 +480,6 @@ def determine_bounds(self): to `self._reaction_bounds`. """ flux_comp_id = self.dfba_solver_options['flux_bounds_volumetric_compartment_id'] - # TODO (APG): since volumes are used, cached volumes must be invalidated before running dFBA if flux_comp_id == self.FLUX_BOUNDS_VOLUMETRIC_COMPARTMENT_ID: flux_comp_volume = self.dynamic_model.cell_volume() else: @@ -688,6 +687,7 @@ def run_fba_solver(self): time_step=self.time_step) # flush expressions that depend on species and reactions modeled by this dFBA submodel from cache + # TODO (APG): OPTIMIZE DFBA CACHING: minimize flushing by implementing OPTIMIZE DFBA CACHING todos elsewhere self.dynamic_model.continuous_submodel_flush_after_populations_change(self.id) ### handle DES events ###