def addGlobalSweepParams(self, sweep, section, config_writer): global_params = ["memory_type"] for param in global_params: config_writer.set(section, param, sweep[param])
def writeGem5Config(self, sweep, benchmark, sweep_dir): """ Write the gem5.cfg file. """ output_dir = os.path.join(sweep_dir, "outputs") benchmark_name = benchmark["name"] output_prefix = os.path.join(output_dir, benchmark_name) config_writer = ConfigParser.SafeConfigParser(DEFAULTS) config_writer.add_section(benchmark_name) # Add the non sweepable parameters. self.addGlobalSweepParams(sweep, benchmark_name, config_writer) config_writer.set(benchmark_name, "accelerator_id", str(benchmark["main_id"])) config_writer.set(benchmark_name, "bench_name", output_prefix) config_writer.set( benchmark_name, "trace_file_name", os.path.join(sweep_dir, "..", "inputs", "dynamic_trace.gz")) config_writer.set(benchmark_name, "config_file_name", os.path.join(sweep_dir, "%s.cfg" % benchmark_name)) cacti_configs = self.getCactiConfigPaths(benchmark_name, sweep_dir) config_writer.set(benchmark_name, "cacti_cache_config", cacti_configs["cache"]) config_writer.set(benchmark_name, "cacti_tlb_config", cacti_configs["tlb"]) # These DB options shouldn't ever be used unless the user has set up a SQL # server, in which case they should set these themselves. config_writer.set(benchmark_name, "use_db", "False") config_writer.set(benchmark_name, "experiment_name", "") # Add all sweepable parameters. output_params = [ param for param in datatypes.Benchmark.sweepable_params ] for param in output_params: value = benchmark[param.name] config_writer.set(benchmark_name, param.name, param.format(value)) output_file = os.path.join(sweep_dir, "gem5.cfg") with open(output_file, "w") as f: config_writer.write(f)