def run(config, results, plotdir): """Run the plot script Parameters ---------- config : str The path of the configuration file results : str The file storing the experiment results plotdir : str The directory into which graphs will be saved """ settings = Settings() settings.read_from(config) config_logging(settings.LOG_LEVEL) resultset = RESULTS_READER[settings.RESULTS_FORMAT](results) # Create dir if not existsing if not os.path.exists(plotdir): os.makedirs(plotdir) # Parse params from settings topologies = settings.TOPOLOGIES cache_sizes = settings.NETWORK_CACHE alphas = settings.ALPHA strategies = settings.STRATEGIES # Plot graphs plot_cache_hit(resultset, topologies, strategies, cache_sizes[0], alphas[0], plotdir) #plot_path_stretch(resultset, topologies, strategies, cache_sizes[0], alphas[0], plotdir) plot_cache_evictions(resultset, topologies, strategies, cache_sizes[0], alphas[0], plotdir) plot_cache_utilization(resultset, topologies, strategies, cache_sizes[0], alphas[0], plotdir) plot_cache_diversity(resultset, topologies, strategies, cache_sizes[0], alphas[0], plotdir) '''
def run(config, output): """ Run function. It starts the simulator. experiments Parameters ---------- config : str Path of the configuration file output : str The file name where results will be saved """ # Read settings from file and save them in icarus.conf.settings settings = Settings() settings.read_from(config) # Config logger config_logging(settings.LOG_LEVEL) # set up orchestration orch = Orchestrator(settings) for sig in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT): signal.signal(sig, functools.partial(handler, settings, orch, output)) logger.info('Launching orchestrator') orch.run() logger.info('Orchestrator finished') results = orch.results results_writer_register[settings.RESULTS_FORMAT](results, output) logger.info('Saved results to file %s' % os.path.abspath(output))
def run(config, results, plotdir): """Run the plot script Parameters ---------- config : str The path of the configuration file results : str The file storing the experiment results plotdir : str The directory into which graphs will be saved """ settings = Settings() settings.read_from(config) config_logging(settings.LOG_LEVEL) resultset = RESULTS_READER[settings.RESULTS_FORMAT](results) # Create dir if not existsing if not os.path.exists(plotdir): os.makedirs(plotdir) # Parse params from settings cache_sizes = settings.NETWORK_CACHE topologies = settings.TOPOLOGIES alphas = settings.ALPHA groups = settings.GROUPS ranks = settings.N_RANKS rank_groups = settings.RANK_GROUPS # Plot graphs for topology in topologies: for alpha in alphas: logger.info('Plotting cache hit ratio for topology %s vs cache size' % (topology)) plot_cache_hits_vs_cache_size(resultset, topology, cache_sizes,rank_groups, plotdir) logger.info('Plotting latency for topology %s vs cache size' % (topology)) plot_latency_vs_cache_size(resultset, topology, cache_sizes, rank_groups,plotdir)
def run(config, results, plotdir): """Run the plot script Parameters ---------- config : str The path of the configuration file results : str The file storing the experiment results plotdir : str The directory into which graphs will be saved """ settings = Settings() settings.read_from(config) config_logging(settings.LOG_LEVEL) resultset = results_reader_register[settings.RESULTS_FORMAT](results) # Create dir if not existsing if not os.path.exists(plotdir): os.makedirs(plotdir) # Parse params from settings topologies = settings.TOPOLOGIES cache_sizes = settings.NETWORK_CACHE alphas = settings.ALPHA strategies = settings.STRATEGIES # Plot graphs for topology in topologies: for cache_size in cache_sizes: logger.info( "Plotting cache hit ratio for topology %s and cache size %s vs alpha" % (topology, str(cache_size)) ) plot_cache_hits_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) logger.info("Plotting link load for topology %s vs cache size %s" % (topology, str(cache_size))) plot_link_load_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) logger.info("Plotting latency for topology %s vs cache size %s" % (topology, str(cache_size))) plot_latency_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) for topology in topologies: for alpha in alphas: logger.info("Plotting cache hit ratio for topology %s and alpha %s vs cache size" % (topology, str(alpha))) plot_cache_hits_vs_cache_size(resultset, topology, alpha, cache_sizes, strategies, plotdir) logger.info("Plotting link load for topology %s and alpha %s vs cache size" % (topology, str(alpha))) plot_link_load_vs_cache_size(resultset, topology, alpha, cache_sizes, strategies, plotdir) logger.info("Plotting latency for topology %s and alpha %s vs cache size" % (topology, str(alpha))) plot_latency_vs_cache_size(resultset, topology, alpha, cache_sizes, strategies, plotdir) for cache_size in cache_sizes: for alpha in alphas: logger.info( "Plotting cache hit ratio for cache size %s vs alpha %s against topologies" % (str(cache_size), str(alpha)) ) plot_cache_hits_vs_topology(resultset, alpha, cache_size, topologies, strategies, plotdir) logger.info( "Plotting link load for cache size %s vs alpha %s against topologies" % (str(cache_size), str(alpha)) ) plot_link_load_vs_topology(resultset, alpha, cache_size, topologies, strategies, plotdir) logger.info("Exit. Plots were saved in directory %s" % os.path.abspath(plotdir))
def run(config, results, plotdir): """Run the plot script Parameters ---------- config : str The path of the configuration file results : str The file storing the experiment results plotdir : str The directory into which graphs will be saved """ settings = Settings() settings.read_from(config) config_logging(settings.LOG_LEVEL) resultset = RESULTS_READER[settings.RESULTS_FORMAT](results) # Create dir if not existsing if not os.path.exists(plotdir): os.makedirs(plotdir) # Parse params from settings topologies = settings.TOPOLOGIES cache_sizes = settings.NETWORK_CACHE alphas = settings.ALPHA strategies = settings.STRATEGIES # Plot graphs for topology in topologies: for cache_size in cache_sizes: plot_cache_hits_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) plot_link_load_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) plot_latency_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) plot_path_stretch_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) for topology in topologies: for alpha in alphas: plot_link_load_vs_cache_size(resultset, topology, alpha, cache_sizes, strategies, plotdir) plot_cache_hits_vs_cache_size(resultset, topology, alpha, cache_sizes, strategies, plotdir) plot_path_strech_vs_cache_size(resultset, topology, alpha, cache_sizes, strategies, plotdir) for cache_size in cache_sizes: for alpha in alphas: plot_cache_hits_vs_topology(resultset, alpha, cache_size, topologies, strategies, plotdir) plot_link_load_vs_topology(resultset, alpha, cache_size, topologies, strategies, plotdir) plot_path_strech_vs_topology(resultset, alpha, cache_size, topologies, strategies, plotdir)
def run(config, results, plotdir): """Run the plot script Parameters ---------- config : str The path of the configuration file results : str The file storing the experiment results plotdir : str The directory into which graphs will be saved """ settings = Settings() settings.read_from(config) config_logging(settings.LOG_LEVEL) resultset = RESULTS_READER[settings.RESULTS_FORMAT](results) # Create dir if not existsing if not os.path.exists(plotdir): os.makedirs(plotdir) # Parse params from settings topologies = settings.TOPOLOGIES cache_sizes = settings.NETWORK_CACHE alphas = settings.ALPHA strategies = settings.STRATEGIES # Plot graphs for topology in topologies: for cache_size in cache_sizes: logger.info('Plotting cache hit ratio for topology %s and cache size %s vs alpha' % (topology, str(cache_size))) plot_cache_hits_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) logger.info('Plotting link load for topology %s vs cache size %s' % (topology, str(cache_size))) plot_link_load_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) logger.info('Plotting latency for topology %s vs cache size %s' % (topology, str(cache_size))) plot_latency_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir) for topology in topologies: for alpha in alphas: logger.info('Plotting cache hit ratio for topology %s and alpha %s vs cache size' % (topology, str(alpha))) plot_cache_hits_vs_cache_size(resultset, topology, alpha, cache_sizes, strategies, plotdir) logger.info('Plotting link load for topology %s and alpha %s vs cache size' % (topology, str(alpha))) plot_link_load_vs_cache_size(resultset, topology, alpha, cache_sizes, strategies, plotdir) logger.info('Plotting latency for topology %s and alpha %s vs cache size' % (topology, str(alpha))) plot_latency_vs_cache_size(resultset, topology, alpha, cache_sizes, strategies, plotdir) for cache_size in cache_sizes: for alpha in alphas: logger.info('Plotting cache hit ratio for cache size %s vs alpha %s against topologies' % (str(cache_size), str(alpha))) plot_cache_hits_vs_topology(resultset, alpha, cache_size, topologies, strategies, plotdir) logger.info('Plotting link load for cache size %s vs alpha %s against topologies' % (str(cache_size), str(alpha))) plot_link_load_vs_topology(resultset, alpha, cache_size, topologies, strategies, plotdir) logger.info('Exit. Plots were saved in directory %s' % os.path.abspath(plotdir))
def run(config, results, plotdir): """Run the plot script Parameters ---------- config : str The path of the configuration file results : str The file storing the experiment results plotdir : str The directory into which graphs will be saved """ settings = Settings() settings.read_from(config) config_logging(settings.LOG_LEVEL) resultset = RESULTS_READER[settings.RESULTS_FORMAT](results) # Create dir if not existsing if not os.path.exists(plotdir): os.makedirs(plotdir) # Parse params from settings topologies = settings.TOPOLOGIES cache_sizes = settings.NETWORK_CACHE alphas = settings.ALPHA strategies = settings.STRATEGIES # Plot graphs for topology in topologies: for i in range(1, 5): fig = plt.figure() ax = fig.add_subplot(1, 4, i) for cache_size in cache_sizes: logger.info( 'Plotting cache hit ratio for topology %s and cache size %s vs alpha' % (topology, str(cache_size))) plot_cache_hits_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir, i) filename = 'CACHE_HIT_RATIO_T=%s@C=%s.pdf' % (topology, cache_size) plt.savefig(os.path.join(plotdir, filename), bbox_inches='tight') plt.close(fig) #logger.info('Plotting link load for topology %s vs cache size %s' % (topology, str(cache_size))) #plot_link_load_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir,i) #logger.info('Plotting latency for topology %s vs cache size %s' % (topology, str(cache_size))) #plot_latency_vs_alpha(resultset, topology, cache_size, alphas, strategies, plotdir,i) '''
def run(config_file, output, config_override): """ Run function. It starts the simulator. experiments Parameters ---------- config : str Path of the configuration file output : str The file name where results will be saved config_override : dict, optional Configuration parameters overriding parameters in the file """ # Read settings from file and save them in icarus.conf.settings settings = Settings() settings.read_from(config_file) if config_override: for k, v in config_override.items(): try: v = eval(v) except NameError: pass settings.set(k, v) # Config logger config_logging(settings.LOG_LEVEL if "LOG_LEVEL" in settings else "INFO") # Validate settings _validate_settings(settings, freeze=True) # set up orchestration orch = Orchestrator(settings) for sig in ( signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT, signal.SIGABRT, ): signal.signal(sig, functools.partial(handler, settings, orch, output)) logger.info("Launching orchestrator") orch.run() logger.info("Orchestrator finished") results = orch.results RESULTS_WRITER[settings.RESULTS_FORMAT](results, output) logger.info("Saved results to file %s" % os.path.abspath(output))
def run(config_file, output, config_override): """ Run function. It starts the simulator. experiments Parameters ---------- config : str Path of the configuration file output : str The file name where results will be saved config_override : dict, optional Configuration parameters overriding parameters in the file """ # Read settings from file and save them in icarus.conf.settings settings = Settings() settings.read_from(config_file) if config_override: for k, v in config_override.items(): try: v = eval(v) except NameError: pass settings.set(k, v) # Config logger config_logging(settings.LOG_LEVEL if 'LOG_LEVEL' in settings else 'INFO') # Validate settings _validate_settings(settings, freeze=True) # set up orchestration orch = Orchestrator(settings) for sig in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT, signal.SIGABRT): signal.signal(sig, functools.partial(handler, settings, orch, output)) logger.info('Launching orchestrator') orch.run() logger.info('Orchestrator finished') results = orch.results RESULTS_WRITER[settings.RESULTS_FORMAT](results, output) logger.info('Saved results to file %s' % os.path.abspath(output))