Commit 09407cb4 authored by Michael Arntzenius's avatar Michael Arntzenius

fix recursive searching problem in Makefile

parent c6f4cbbd
......@@ -922,15 +922,23 @@ clean:
# A helper function that lets me run subdirectory rules from the top level;
# ex instead of saying "make tests/run_1", I can just write "make run_1"
#
# The target to ultimately be called must be prefixed with nosearch_, for example:
# nosearch_example_%: %.py
# echo $^
# $(call make_search,example_%)
# This prevents us from searching recursively, which can result in a combinatorial explosion.
define make_search
$(eval \
$1: $(TESTS_DIR)/$1 ;
$1: $(TEST_DIR)/cpython/$1 ;
$1: ./microbenchmarks/$1 ;
$1: ./minibenchmarks/$1 ;
$1: ./benchmarks/$1 ;
$1: $(HOME)/pyston-perf/benchmarking/benchmark_suite/$1 ;
$(patsubst %, $$1: %/$$1 ;,$(EXTRA_SEARCH_DIRS))
.PHONY: $1 nosearch_$1
$1: nosearch_$1
$1: $(TESTS_DIR)/nosearch_$1 ;
$1: $(TEST_DIR)/cpython/nosearch_$1 ;
$1: ./microbenchmarks/nosearch_$1 ;
$1: ./minibenchmarks/nosearch_$1 ;
$1: ./benchmarks/nosearch_$1 ;
$1: $(HOME)/pyston-perf/benchmarking/benchmark_suite/nosearch_$1 ;
$(patsubst %, $$1: %/nosearch_$$1 ;,$(EXTRA_SEARCH_DIRS))
)
endef
......@@ -951,31 +959,31 @@ run$1: pyston$1 $$(RUN_DEPS)
./pyston$1 $$(ARGS)
dbg$1: pyston$1 $$(RUN_DEPS)
zsh -c 'ulimit -v $$(MAX_DBG_MEM_KB); $$(GDB) $$(GDB_CMDS) --args ./pyston$1 $$(ARGS)'
run$1_%: %.py pyston$1 $$(RUN_DEPS)
nosearch_run$1_%: %.py pyston$1 $$(RUN_DEPS)
$(VERB) zsh -c 'ulimit -v $$(MAX_MEM_KB); ulimit -d $$(MAX_MEM_KB); time ./pyston$1 $$(ARGS) $$<'
$$(call make_search,run$1_%)
dbg$1_%: %.py pyston$1 $$(RUN_DEPS)
nosearch_dbg$1_%: %.py pyston$1 $$(RUN_DEPS)
$(VERB) zsh -c 'ulimit -v $$(MAX_DBG_MEM_KB); $$(GDB) $$(GDB_CMDS) --args ./pyston$1 $$(ARGS) $$<'
$$(call make_search,dbg$1_%)
ifneq ($$(ENABLE_VALGRIND),0)
memcheck$1_%: %.py pyston$1 $$(RUN_DEPS)
nosearch_memcheck$1_%: %.py pyston$1 $$(RUN_DEPS)
$$(VALGRIND) --tool=memcheck --leak-check=no --db-attach=yes ./pyston$1 $$(ARGS) $$<
$$(call make_search,memcheck$1_%)
memcheck_gdb$1_%: %.py pyston$1 $$(RUN_DEPS)
nosearch_memcheck_gdb$1_%: %.py pyston$1 $$(RUN_DEPS)
set +e; $$(VALGRIND) -v -v -v -v -v --tool=memcheck --leak-check=no --track-origins=yes --vgdb=yes --vgdb-error=0 ./pyston$1 $$(ARGS) $$< & export PID=$$$$! ; \
$$(GDB) --ex "set confirm off" --ex "target remote | $$(DEPS_DIR)/valgrind-3.10.0-install/bin/vgdb" --ex "continue" --ex "bt" ./pyston$1; kill -9 $$$$PID
$$(call make_search,memcheck_gdb$1_%)
memleaks$1_%: %.py pyston$1 $$(RUN_DEPS)
nosearch_memleaks$1_%: %.py pyston$1 $$(RUN_DEPS)
$$(VALGRIND) --tool=memcheck --leak-check=full --leak-resolution=low --show-reachable=yes ./pyston$1 $$(ARGS) $$<
$$(call make_search,memleaks$1_%)
cachegrind$1_%: %.py pyston$1 $$(RUN_DEPS)
nosearch_cachegrind$1_%: %.py pyston$1 $$(RUN_DEPS)
$$(VALGRIND) --tool=cachegrind ./pyston$1 $$(ARGS) $$<
$$(call make_search,cachegrind$1_%)
endif
.PHONY: perf$1_%
perf$1_%: %.py pyston$1
nosearch_perf$1_%: %.py pyston$1
perf record -g -- ./pyston$1 -q -p $$(ARGS) $$<
@$(MAKE) perf_report
$$(call make_search,perf$1_%)
......@@ -1007,16 +1015,16 @@ $(call make_target,_release)
$(call make_target,_prof)
$(call make_target,_gcc)
runpy_% pyrun_%: %.py ext_python
nosearch_runpy_% nosearch_pyrun_%: %.py ext_python
$(VERB) PYTHONPATH=test/test_extension/build/lib.linux-x86_64-2.7 zsh -c 'time python $<'
$(call make_search,runpy_%)
$(call make_search,pyrun_%)
check_%: %.py ext_python ext_pyston
nosearch_check_%: %.py ext_python ext_pyston
$(MAKE) check_dbg ARGS="$(patsubst %.py,%,$(notdir $<)) -K"
$(call make_search,check_%)
dbgpy_% pydbg_%: %.py ext_pythondbg
nosearch_dbgpy_% nosearch_pydbg_%: %.py ext_pythondbg
export PYTHON_VERSION=$$(python2.7-dbg -V 2>&1 | awk '{print $$2}'); PYTHONPATH=test/test_extension/build/lib.linux-x86_64-2.7-pydebug $(GDB) --ex "dir $(DEPS_DIR)/python-src/python2.7-$$PYTHON_VERSION/debian" $(GDB_CMDS) --args python2.7-dbg $<
$(call make_search,dbgpy_%)
$(call make_search,pydbg_%)
......@@ -1026,19 +1034,17 @@ kv:
ps aux | awk '/[v]algrind/ {print $$2}' | xargs kill -9; true
# gprof-based profiling:
.PHONY: prof_% profile_%
prof_%: %.py pyston_prof
nosearch_prof_%: %.py pyston_prof
zsh -c 'time ./pyston_prof $(ARGS) $<'
gprof ./pyston_prof gmon.out > $(patsubst %,%.out,$@)
$(call make_search,prof_%)
profile_%: %.py pyston_profile
nosearch_profile_%: %.py pyston_profile
time ./pyston_profile -p $(ARGS) $<
gprof ./pyston_profile gmon.out > $(patsubst %,%.out,$@)
$(call make_search,profile_%)
# pprof-based profiling:
.PHONY: pprof_% pprof_release_%
pprof_%: %.py $(PYTHON_EXE_DEPS) pyston_pprof
nosearch_pprof_%: %.py $(PYTHON_EXE_DEPS) pyston_pprof
CPUPROFILE_FREQUENCY=1000 CPUPROFILE=$@.out ./pyston_pprof -p $(ARGS) $<
pprof --raw pyston_pprof $@.out > $@_raw.out
$(PYTHON) codegen/profiling/process_pprof.py $@_raw.out pprof.jit > $@_processed.out
......@@ -1047,7 +1053,7 @@ pprof_%: %.py $(PYTHON_EXE_DEPS) pyston_pprof
$(call make_search,pprof_%)
# oprofile-based profiling:
.PHONY: oprof_% oprof_collect_% opreport
.PHONY: oprof_collect_% opreport
oprof_collect_%: %.py pyston_oprof
sudo opcontrol --image pyston_oprof
# sudo opcontrol --event CPU_CLK_UNHALTED:28000
......@@ -1060,7 +1066,7 @@ oprof_collect_%: %.py pyston_oprof
sudo opcontrol --image all --event default --cpu-buffer-size=0 --buffer-size=0 --buffer-watershed=0
sudo opcontrol --deinit
sudo opcontrol --init
oprof_%: oprof_collect_%
nosearch_oprof_%: oprof_collect_%
$(MAKE) opreport
$(call make_search,oprof_%)
opreport:
......@@ -1068,10 +1074,10 @@ opreport:
opreport -l -t 0.2 -a pyston_oprof
# opreport lib-image:pyston_oprof -l -t 0.2 -a | head -n 25
.PHONY: oprofcg_% oprof_collectcg_% opreportcg
.PHONY: oprof_collectcg_% opreportcg
oprof_collectcg_%: %.py pyston_oprof
operf -g -e CPU_CLK_UNHALTED:90000 ./pyston_oprof -p $(ARGS) $<
oprofcg_%: oprof_collectcg_%
nosearch_oprofcg_%: oprof_collectcg_%
$(MAKE) opreportcg
$(call make_search,oprofcg_%)
opreportcg:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment