Skip to content

Commit

Permalink
Update Makefiles to those used to produce the benchmark data
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoo092 committed Jun 19, 2020
1 parent 4f7be5b commit a57cf05
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 12 deletions.
68 changes: 60 additions & 8 deletions Racket/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ space := $(nullstring) # end of the line
spaces-to-commas = $(subst $(space),$(comma),$(strip $(1)))

# A selection of powers of two for the escalating
# iteration count. These start at one, and are multiplied by 2**3 each
# iteration count. These start at one, and are multiplied by 2**6 each
# increase to derive the new number.
# This variable is applied universally across the benchmarks.
#ITERATIONS = 1 8 64 512 4096 #32768 262144 2097152 16777216
ITERATIONS = 1 64 4096 #262144 16777216

# For most programs, this is the number of threads to be used. For
Expand Down Expand Up @@ -138,37 +139,88 @@ define for_iters =
endef

bench_all: $(bench_names)
#bench_all: bench_commstime bench_montecarlopi bench_selecttime

# bench_commstime works differently from the others, since, at present
# at least, it only takes one parameter, meaning that hyperfine
# can handle everything without resorting to an external for loop.
bench_commstime: $(exes_dir)/commstime | $(benches_dir)
@echo benches_record_name = $(benches_record_name)
$(hypw3) --parameter-list num_iters "$(call spaces-to-commas,$(ITERATIONS))" "$< {num_iters}"

# Note that this one is different from most of the others in that it
# requires an extra input, which requires both adapting the iter_command
# as well as wrapping for_iters with another for loop. Unfortunately,
# to get things to work, I need to use a variable named j in the loop
# wrapping the one which uses the variable i...
bench_linalg: $(exes_dir)/linalg | $(benches_dir)
#~ bench_linalg: $(exes_dir)/linalg | $(benches_dir)
#~ for j in $(LINALG_OPTS); do\
#~ $(for_iters);\
#~ done

bench_linalg:
make bench_linalg1
make bench_linalg2

bench_linalg1 : iter_command = $(hypw3) --parameter-list vecs_size "$(call spaces-to-commas,$(VECTORS))" "$< $$j $$i {vecs_size}"
bench_linalg1 : VECTORS = 2 3 4 8 16 32
bench_linalg1: $(exes_dir)/linalg | $(benches_dir)
for j in $(LINALG_OPTS); do\
$(for_iters);\
done

bench_linalg2 : iter_command = $(hypw3) --parameter-list vecs_size "$(call spaces-to-commas,$(VECTORS))" "$< $$j $$i {vecs_size}"
bench_linalg2 : VECTORS = 128
bench_linalg2 : ITERATIONS = 1 64
bench_linalg2: $(exes_dir)/linalg | $(benches_dir)
for j in $(LINALG_OPTS); do\
$(for_iters);\
done

bench_montecarlopi : THREADS = 2 16 128 1024 8192
bench_montecarlopi: $(exes_dir)/montecarlopi | $(benches_dir)
$(for_iters)

bench_selecttime: $(exes_dir)/selecttime | $(benches_dir)
$(for_iters)

#~ bench_spawn: $(exes_dir)/spawn | $(benches_dir)
#~ $(for_iters)

bench_spawn: $(exes_dir)/spawn | $(benches_dir)
make bench_spawn1
make bench_spawn2

bench_spawn1 : THREADS = 2 16 128 1024
bench_spawn1 : iter_command = $(hypw3) --parameter-list num_threads "$(call spaces-to-commas,$(THREADS))" "$< $$i {num_threads}"
bench_spawn1: $(exes_dir)/spawn | $(benches_dir)
$(for_iters)

bench_spawn2 : THREADS = 8192
bench_spawn2 : ITERATIONS = 1 64
bench_spawn2 : iter_command = $(hypw3) --parameter-list num_threads "$(call spaces-to-commas,$(THREADS))" "$< $$i {num_threads}"
bench_spawn2: $(exes_dir)/spawn | $(benches_dir)
$(for_iters)

# This has the same issues as bench_linalg - see the comment there.
#~ bench_whispers: $(exes_dir)/whispers | $(benches_dir)
#~ for j in $(WHISPERS_OPTS); do\
#~ $(for_iters); \
#~ done

bench_whispers: $(exes_dir)/whispers | $(benches_dir)
@echo benches_record_name = $(benches_record_name)
make bench_whispers1
make bench_whispers2

bench_whispers1 : THREADS = 2 16 128 1024
bench_whispers1 : iter_command = $(hypw3) --parameter-list num_threads "$(call spaces-to-commas,$(THREADS))" "$< $$j $$i {num_threads}"
bench_whispers1: $(exes_dir)/whispers | $(benches_dir)
for j in $(WHISPERS_OPTS); do\
$(for_iters); \
done

bench_whispers2 : THREADS = 8192
bench_whispers2 : ITERATIONS = 1 64
bench_whispers2 : iter_command = $(hypw3) --parameter-list num_threads "$(call spaces-to-commas,$(THREADS))" "$< $$j $$i {num_threads}"
bench_whispers2: $(exes_dir)/whispers | $(benches_dir)
for j in $(WHISPERS_OPTS); do\
$(for_iters); \
done
Expand All @@ -192,15 +244,15 @@ clean_bench:
clean_all:
@make clean
@make clean_bench

##################################################

# Rules to ensure that the required sub-directories are in fact extant.
# This approach is based upon answers to the following Stack Overflow
# question: https://stackoverflow.com/q/1950926

$(exes_dir):
mkdir -p $(exes_dir)
@mkdir -p $(exes_dir)

$(benches_dir):
mkdir -p $(benches_dir)
@mkdir -p $(benches_dir)
59 changes: 55 additions & 4 deletions TypedRacket/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,37 +139,88 @@ define for_iters =
endef

bench_all: $(bench_names)
#bench_all: bench_commstime bench_montecarlopi bench_selecttime

# bench_commstime works differently from the others, since, at present
# at least, it only takes one parameter, meaning that hyperfine
# can handle everything without resorting to an external for loop.
bench_commstime: $(exes_dir)/commstime | $(benches_dir)
@echo benches_record_name = $(benches_record_name)
$(hypw3) --parameter-list num_iters "$(call spaces-to-commas,$(ITERATIONS))" "$< {num_iters}"

# Note that this one is different from most of the others in that it
# requires an extra input, which requires both adapting the iter_command
# as well as wrapping for_iters with another for loop. Unfortunately,
# to get things to work, I need to use a variable named j in the loop
# wrapping the one which uses the variable i...
bench_linalg: $(exes_dir)/linalg | $(benches_dir)
#~ bench_linalg: $(exes_dir)/linalg | $(benches_dir)
#~ for j in $(LINALG_OPTS); do\
#~ $(for_iters);\
#~ done

bench_linalg:
make bench_linalg1
make bench_linalg2

bench_linalg1 : iter_command = $(hypw3) --parameter-list vecs_size "$(call spaces-to-commas,$(VECTORS))" "$< $$j $$i {vecs_size}"
bench_linalg1 : VECTORS = 2 3 4 8 16 32
bench_linalg1: $(exes_dir)/linalg | $(benches_dir)
for j in $(LINALG_OPTS); do\
$(for_iters);\
done

bench_linalg2 : iter_command = $(hypw3) --parameter-list vecs_size "$(call spaces-to-commas,$(VECTORS))" "$< $$j $$i {vecs_size}"
bench_linalg2 : VECTORS = 128
bench_linalg2 : ITERATIONS = 1 64
bench_linalg2: $(exes_dir)/linalg | $(benches_dir)
for j in $(LINALG_OPTS); do\
$(for_iters);\
done

bench_montecarlopi : THREADS = 2 16 128 1024 8192
bench_montecarlopi: $(exes_dir)/montecarlopi | $(benches_dir)
$(for_iters)

bench_selecttime: $(exes_dir)/selecttime | $(benches_dir)
$(for_iters)

#~ bench_spawn: $(exes_dir)/spawn | $(benches_dir)
#~ $(for_iters)

bench_spawn: $(exes_dir)/spawn | $(benches_dir)
make bench_spawn1
make bench_spawn2

bench_spawn1 : THREADS = 2 16 128 1024
bench_spawn1 : iter_command = $(hypw3) --parameter-list num_threads "$(call spaces-to-commas,$(THREADS))" "$< $$i {num_threads}"
bench_spawn1: $(exes_dir)/spawn | $(benches_dir)
$(for_iters)

bench_spawn2 : THREADS = 8192
bench_spawn2 : ITERATIONS = 1 64
bench_spawn2 : iter_command = $(hypw3) --parameter-list num_threads "$(call spaces-to-commas,$(THREADS))" "$< $$i {num_threads}"
bench_spawn2: $(exes_dir)/spawn | $(benches_dir)
$(for_iters)

# This has the same issues as bench_linalg - see the comment there.
#~ bench_whispers: $(exes_dir)/whispers | $(benches_dir)
#~ for j in $(WHISPERS_OPTS); do\
#~ $(for_iters); \
#~ done

bench_whispers: $(exes_dir)/whispers | $(benches_dir)
@echo benches_record_name = $(benches_record_name)
make bench_whispers1
make bench_whispers2

bench_whispers1 : THREADS = 2 16 128 1024
bench_whispers1 : iter_command = $(hypw3) --parameter-list num_threads "$(call spaces-to-commas,$(THREADS))" "$< $$j $$i {num_threads}"
bench_whispers1: $(exes_dir)/whispers | $(benches_dir)
for j in $(WHISPERS_OPTS); do\
$(for_iters); \
done

bench_whispers2 : THREADS = 8192
bench_whispers2 : ITERATIONS = 1 64
bench_whispers2 : iter_command = $(hypw3) --parameter-list num_threads "$(call spaces-to-commas,$(THREADS))" "$< $$j $$i {num_threads}"
bench_whispers2: $(exes_dir)/whispers | $(benches_dir)
for j in $(WHISPERS_OPTS); do\
$(for_iters); \
done
Expand Down

0 comments on commit a57cf05

Please sign in to comment.