Permalink
Browse files

[simulation] Changed the simulation running infrastructure for Graphite

For details, look at the first 30 lines of carbon_sim.cfg
  • Loading branch information...
1 parent f1c0d88 commit 356ecf6b897308eb663f93cb1f5e625e0c2bcb9b George Kurian committed Dec 9, 2012
Showing with 43 additions and 30 deletions.
  1. +0 −1 .gitignore
  2. +5 −8 Makefile
  3. +15 −6 carbon_sim.cfg
  4. +4 −4 tests/Makefile.parsec
  5. +18 −10 tests/Makefile.tests
  6. +1 −1 tools/schedule.py
View
@@ -13,7 +13,6 @@
pin.log
pintool.log
sim.out
-output_files
# misc
lib/libcarbon_sim.a
View
@@ -5,7 +5,7 @@ CLEAN=$(findstring clean,$(MAKECMDGOALS))
LIB_CARBON=$(SIM_ROOT)/lib/libcarbon_sim.a
LIB_PIN_SIM=$(SIM_ROOT)/pin/../lib/pin_sim.so
-all: output_files $(LIB_CARBON) $(LIB_PIN_SIM)
+all: $(LIB_CARBON) $(LIB_PIN_SIM)
include common/Makefile
include tests/apps/Makefile
@@ -19,17 +19,14 @@ endif
$(LIB_PIN_SIM):
$(MAKE) -C $(SIM_ROOT)/pin $@
-clean: empty_logs
+clean:
$(MAKE) -C pin clean
$(MAKE) -C common clean
$(MAKE) -C tests/unit clean
$(MAKE) -C tests/apps clean
$(MAKE) -C tests/benchmarks clean
-regress_quick: output_files regress_unit regress_apps
+clean_output_dirs:
+ rm -rf $(SIM_ROOT)/results/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9] $(SIM_ROOT)/results/current
-output_files:
- mkdir output_files
-
-empty_logs :
- rm output_files/* ; true
+regress_quick: regress_unit regress_apps
View
@@ -9,12 +9,21 @@
# This section controls various high-level simulation parameters.
[general]
-# This is the directory where the logs as well as the simulation
-# result is stored.
-output_dir = "./output_files/"
-
-# This is the name of the file, under the output directory (defined
-# above) that the statistics for each core are written to.
+# output_file: This is the name of the file that the statistics
+# for each core are written to.
+# The directory where this file is placed is dynamically generated.
+# The default location is ./results/$(DATE)/
+# where $(DATE) format is %Y-%m-%d_%H-%M-%S
+# You can use OUTPUT_DIR=<directory> to place the output of the simulation
+# in a specific directory
+# e.g., make radix_bench_test OUTPUT_DIR=radix
+# will place the output in the directory ./results/radix/
+# Also, ./results/current/ is a symbolic link that points to the
+# output directory of the most recently started simulation
+# Each output directory, in addition to the output_file also contains
+# (a) the configuration file used ('carbon_sim.cfg')
+# (b) the command used to run the simulation ('command')
+# (c) log files that are produced ('*.log')
output_file = "sim.out"
# Total number of cores in the simulation
View
@@ -27,19 +27,19 @@ streamcluster_flags ?= 10 20 32 4096 4096 1000 none output.txt 64
include tests/Makefile.tests
DIRECTORY ?= $(if $(findstring $(patsubst %_parsec,%,$@),$(APPS)),apps,kernels)
-COMMAND ?= export GRAPHITE_HOME=$(SIM_ROOT); mkdir -p $(PARSEC_HOME)/pkgs/$(DIRECTORY)/$(patsubst %_parsec,%,$@)/run; cd $(PARSEC_HOME)/pkgs/$(DIRECTORY)/$(patsubst %_parsec,%,$@)/run; $(call run_fn,$(MODE),$(PARSEC_HOME)/pkgs/$(DIRECTORY)/$(patsubst %_parsec,%,$@)/inst/amd64-linux.graphite/bin/$(patsubst %_parsec,%,$@) $($(patsubst %_parsec,%,$@)_flags),$(PROCS),$(SIM_FLAGS),$(CONFIG_FILE))
+COMMAND ?= export GRAPHITE_HOME=$(SIM_ROOT); mkdir -p $(PARSEC_HOME)/pkgs/$(DIRECTORY)/$(patsubst %_parsec,%,$@)/run; cd $(PARSEC_HOME)/pkgs/$(DIRECTORY)/$(patsubst %_parsec,%,$@)/run; $(call run_fn,$(MODE),$(PARSEC_HOME)/pkgs/$(DIRECTORY)/$(patsubst %_parsec,%,$@)/inst/amd64-linux.graphite/bin/$(patsubst %_parsec,%,$@) $($(patsubst %_parsec,%,$@)_flags),$(PROCS),$(SIM_FLAGS),$(CONFIG_FILE_ABS_PATH))
-freqmine_parsec:
+freqmine_parsec: create_output_dir
export GRAPHITE_HOME=$(SIM_ROOT);$(PARSEC_HOME)/bin/parsecmgmt -a build -p $(patsubst %_parsec,%,$@) -c graphite
export OMP_NUM_THREADS=64
$(COMMAND)
-vips_parsec:
+vips_parsec: create_output_dir
export GRAPHITE_HOME=$(SIM_ROOT);$(PARSEC_HOME)/bin/parsecmgmt -a build -p $(patsubst %_parsec,%,$@) -c graphite
export IM_CONCURRENCY=64
$(COMMAND)
-%_parsec:
+%_parsec: create_output_dir
export GRAPHITE_HOME=$(SIM_ROOT);$(PARSEC_HOME)/bin/parsecmgmt -a build -p $(patsubst %_parsec,%,$@) -c graphite
$(COMMAND)
View
@@ -16,7 +16,7 @@
# BUILD_MODE - set to build to not run anything
# MODE - set to 'pin' to use pin, set to '' for running application standalone
# CONFIG_FILE - configuration file to use to run the Graphite simulator
-# OUTPUT_FILE - file to write the simulation output
+# OUTPUT_DIR - directory to write the simulation output
# APP_SPECIFIC_CXX_FLAGS - application-specific CXX flags (e.g., include paths)
# SIM_FLAGS - config flags passed to the simulator. Derived from CORES, PROCS. See sim_flags_fn.
# EXEC - command to run; derived from TARGET and APP_FLAGS
@@ -39,26 +39,34 @@ ENABLE_SM ?= true
APP_FLAGS ?=
BUILD_MODE ?= # Set to build to not run anything
MODE ?= pin # Set to 'pin' to use pin
-CONFIG_FILE ?= $(SIM_ROOT)/carbon_sim.cfg
-OUTPUT_DIR ?= $(SIM_ROOT)/output_files
-OUTPUT_FILE ?= sim.out
+CONFIG_FILE ?= carbon_sim.cfg
+OUTPUT_DIR ?= $(shell date +%Y-%m-%d_%H-%M-%S)
APP_SPECIFIC_CXX_FLAGS ?=
+CONFIG_FILE_ABS_PATH ?= $(SIM_ROOT)/$(CONFIG_FILE)
+OUTPUT_DIR_ABS_PATH ?= $(SIM_ROOT)/results/$(OUTPUT_DIR)
# Use: $(call sim_flags_fn, $(1-CORES), $(2-PROCS))
-sim_flags_fn = -c $(CONFIG_FILE) --general/total_cores=$(1) --general/num_processes=$(2) --general/enable_shared_mem=$(3) --general/output_dir=$(4) --general/output_file=$(5)
-SIM_FLAGS ?= $(call sim_flags_fn,$(CORES),$(PROCS),$(ENABLE_SM),$(OUTPUT_DIR),$(OUTPUT_FILE))
+sim_flags_fn = -c $(CONFIG_FILE_ABS_PATH) --general/total_cores=$(1) --general/num_processes=$(2) --general/enable_shared_mem=$(3) --general/output_dir=$(4)
+SIM_FLAGS ?= $(call sim_flags_fn,$(CORES),$(PROCS),$(ENABLE_SM),$(OUTPUT_DIR_ABS_PATH))
EXEC ?= $(CURDIR)/$(TARGET) $(APP_FLAGS) # command thats actually executed
-launch_fn = $(SIM_ROOT)/tools/spawn_master.py $(1) $(2) # 1 - NUM_PROCS # 2 - config file
+launch_fn = $(SIM_ROOT)/tools/spawn_master.py $(1) $(2) # 1 - NUM_PROCS # 2 - CONFIG_FILE
-# Use: $(call run_fn, $(1-MODE), $(2-EXEC), $(3-PROCS), $(4-FLAGS))
+# Use: $(call run_fn, $(1-MODE), $(2-EXEC), $(3-PROCS), $(4-FLAGS), $(5-CONFIG_FILE_ABS_PATH))
run_fn = $(if $(findstring build,$(BUILD_MODE)), ,$(if $(findstring pin,$(1)),$(call launch_fn,$(3),$(5)) $(PIN_RUN) $(4) -- $(2),$(call launch_fn,$(3),$(5)) $(VALGRIND) $(2) $(4)))
-RUN ?= cd $(SIM_ROOT) ; $(call run_fn,$(MODE),$(EXEC),$(PROCS),$(SIM_FLAGS),$(CONFIG_FILE))
+RUN ?= cd $(SIM_ROOT) ; $(call run_fn,$(MODE),$(EXEC),$(PROCS),$(SIM_FLAGS),$(CONFIG_FILE_ABS_PATH))
# Build targets
-all: $(TARGET)
+all: $(TARGET) create_output_dir
$(RUN)
+create_output_dir:
+ rm -f $(SIM_ROOT)/results/current
+ mkdir -p $(OUTPUT_DIR_ABS_PATH)
+ echo "$(RUN)" > $(OUTPUT_DIR_ABS_PATH)/command
+ cp $(CONFIG_FILE_ABS_PATH) $(OUTPUT_DIR_ABS_PATH)/carbon_sim.cfg
+ ln -s $(OUTPUT_DIR_ABS_PATH) $(SIM_ROOT)/results/current
+
# Compiler flags
LD_FLAGS = -static -u CarbonStartSim -u CarbonStopSim -u pthread_create -u pthread_join -L$(SIM_ROOT)/lib
LD_LIBS = -lcarbon_sim -pthread
View
@@ -73,7 +73,7 @@ def kill(self):
# a job built around the make system
class MakeJob(SpawnJob):
- def __init__(self, num_machines, command, results_dir="./output_files", sub_dir="", sim_flags="", mode="pin"):
+ def __init__(self, num_machines, command, results_dir, sub_dir, sim_flags, mode="pin"):
SpawnJob.__init__(self, num_machines, command)
self.results_dir = results_dir
self.sub_dir = "%s/%s" % (results_dir, sub_dir)

0 comments on commit 356ecf6

Please sign in to comment.