def test_setup(self): try: ParallelPluginCollection(None, "test.plugin.range_map_plugin") pytest.fail("No list provided") except InvalidLoopException: assert True try: ParallelPluginCollection([], None) pytest.fail("No map plugin provided") except InvalidAttributeException: assert True
def test_parallel_plugin_collection_pickle(self): ctx = context.ctx() parallelPluginCollection = ParallelPluginCollection( "ivy.plugin.simple_map_plugin", ["ivy.plugin.simple_square_plugin"], "ivy.plugin.simple_reduce_plugin") sParallelPluginCollection = dumps(parallelPluginCollection) parallelPluginCollectio2 = loads(sParallelPluginCollection)
def __call__(self): keyword = ParallelPluginCollection([], 0, None).__str__() total = sum((timing.duration for timing in self.ctx.timings if timing.name is not keyword)) print("== Ivy run took: {0:>7.3f} s ===".format(total)) timing_map = self._reorder_timings(self.ctx.timings) for timing in timing_map.values(): print(self._join_timings(timing))
def _reorder_timings(self, timings): timing_map = OrderedDict() keyword = ParallelPluginCollection([], 0, None).__str__() for timing in timings: if timing.name is not keyword: try: timing_map[timing.name].addTiming(timing) except KeyError: timing_map[timing.name] = TimingCollection(timing.name) timing_map[timing.name].duration = timing.duration timing_map[timing.name].addTiming(timing) return timing_map
def test_multiprocessing(self): ctx = context.ctx() ctx.timings = [] ctx.params = context._createImmutableCtx(backend="multiprocessing", cpu_count=8, valuesMin = 1, valuesMax = 10) mapPlugin = range_map_plugin.Plugin(ctx) pluginList = [PLUGIN_NAME] reducePlugin = sum_reduce_plugin.Plugin(ctx) parallelPluginCollection = ParallelPluginCollection(pluginList, mapPlugin, reducePlugin) parallelPluginCollection() assert ctx.valuesSum == 285
# IVY is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # IVY is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with IVY. If not, see <http://www.gnu.org/licenses/>. ''' author: jakeret ''' # from ivy.config import base_config from ivy.plugin.parallel_plugin_collection import ParallelPluginCollection backend = "sequential" cpu_count = 1 valuesMin = 1 valuesMax = 16 plugins = ParallelPluginCollection(["ivy.plugin.simple_square_plugin"], "ivy.plugin.range_map_plugin", "ivy.plugin.sum_reduce_plugin")
from ivy.plugin.parallel_plugin_collection import ParallelPluginCollection plugins = [ "seek.plugins.find_nested_files", "seek.plugins.calibration", "seek.plugins.initialize", # comment out everything below when doing calibration-only analysis ParallelPluginCollection( [ # "seek.plugins.load_preprocessed_data", "seek.plugins.load_data", "seek.plugins.pre_process_tod", "seek.plugins.process_coords", "seek.plugins.mask_objects", "seek.plugins.mask_artefacts", "seek.plugins.remove_RFI", "seek.plugins.post_process_tod", "seek.plugins.background_removal", "seek.plugins.restructure_tod", ], "seek.plugins.map_file_paths", "seek.plugins.reduce_map_indicies"), ParallelPluginCollection(["seek.plugins.create_maps"], "seek.plugins.map_indicies", "seek.plugins.reduce_maps"), "seek.plugins.write_maps", "ivy.plugin.show_stats", ] from seek.config import common
# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # IVY is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with IVY. If not, see <http://www.gnu.org/licenses/>. ''' Created on Mar 5, 2014 author: jakeret ''' # from ivy.config import base_config from ivy.plugin.parallel_plugin_collection import ParallelPluginCollection backend = "sequential" cpu_count = 1 valuesMin = 1 valuesMax = 10 plugins = [ "test.plugin.simple_plugin", ParallelPluginCollection(["test.plugin.simple_square_plugin"], "test.plugin.range_map_plugin", "test.plugin.sum_reduce_plugin"), "test.plugin.simple_plugin" ]
plugins = ["hide.plugins.initialize", "hide.plugins.load_beam_profile", "hide.plugins.scanning_strategy", "hide.plugins.write_coords", ParallelPluginCollection([ "hide.plugins.qu_opt_coord_transform", ParallelPluginCollection([ "hide.plugins.astro_signal", "hide.plugins.earth_signal", "hide.plugins.combine_signals", ], "hide.plugins.map_frequency_plugin", "hide.plugins.reduce_frequency_plugin", # parallel=False ), "hide.plugins.apply_gain", "hide.plugins.add_rfi", "hide.plugins.background_noise", "hide.plugins.add_reference", "hide.plugins.write_tod_fits", "hide.plugins.clean_up", ], "hide.plugins.map_strategy_plugin", #"hide.plugins.reduce_signals_plugin", ), "ivy.plugin.show_summary_stats" ]