Source

benchmark_rnn / Makefile

ALL_GCC = \
	rnn_ca1d-gcc-O2 rnn_ca1d-gcc-O3 \
	rnn_ca2d-gcc-O2 rnn_ca2d-gcc-O3 \
	rnn_opt0-gcc-O2 rnn_opt0-gcc-O3 \
	rnn_opt1-gcc-O2 rnn_opt1-gcc-O3 \
	rnn_opt2-gcc-O2 rnn_opt2-gcc-O3 \
	rnn_opt3-gcc-O2 rnn_opt3-gcc-O3 \
	rnn_opt4-gcc-O2 rnn_opt4-gcc-O3 \

ALL_ICC = \
	rnn_ca1d-icc-O2 rnn_ca1d-icc-O3 \
	rnn_ca2d-icc-O2 rnn_ca2d-icc-O3 \
	rnn_opt0-icc-O2 rnn_opt0-icc-O3 \
	rnn_opt1-icc-O2 rnn_opt1-icc-O3 \
	rnn_opt2-icc-O2 rnn_opt2-icc-O3 \
	rnn_opt3-icc-O2 rnn_opt3-icc-O3 \
	rnn_opt4-icc-O2 rnn_opt4-icc-O3 \

ALL_O64 = \
	rnn_ca1d-o64-O2 rnn_ca1d-o64-O3 rnn_ca1d-o64-Ofast \
	rnn_ca2d-o64-O2 rnn_ca2d-o64-O3 rnn_ca2d-o64-Ofast \
	rnn_opt0-o64-O2 rnn_opt0-o64-O3 rnn_opt0-o64-Ofast \
	rnn_opt1-o64-O2 rnn_opt1-o64-O3 rnn_opt1-o64-Ofast \
	rnn_opt2-o64-O2 rnn_opt2-o64-O3 rnn_opt2-o64-Ofast \
	rnn_opt3-o64-O2 rnn_opt3-o64-O3 rnn_opt3-o64-Ofast \
	rnn_opt4-o64-O2 rnn_opt4-o64-O3 rnn_opt4-o64-Ofast \

ALL=${ALL_GCC} ${ALL_ICC} ${ALL_O64}


.PHONY: clean all all-gcc all-icc all-o64 runtest

all: ${ALL}
all-gcc: ${ALL_GCC}
all-icc: ${ALL_ICC}
all-o64: ${ALL_O64}

clean:
	rm ${ALL}

rnn_ca1d-gcc-O2: rnn_ca1d.c
	gcc -lm -ffast-math -O2 $< -o $@
rnn_ca1d-gcc-O3: rnn_ca1d.c
	gcc -lm -ffast-math -O3 $< -o $@ -ftree-vectorizer-verbose=1
rnn_ca1d-icc-O2: rnn_ca1d.c
	icc -vec-report1 -O2 $< -o $@
rnn_ca1d-icc-O3: rnn_ca1d.c
	icc -vec-report1 -O3 $< -o $@
rnn_ca1d-o64-O2: rnn_ca1d.c
	opencc -lm -ipa -O2 $< -o $@
rnn_ca1d-o64-O3: rnn_ca1d.c
	opencc -lm -ipa -O3 $< -o $@
rnn_ca1d-o64-Ofast: rnn_ca1d.c
	opencc -lm -ipa -Ofast $< -o $@

rnn_ca2d-gcc-O2: rnn_ca2d.c
	gcc -lm -ffast-math -O2 $< -o $@
rnn_ca2d-gcc-O3: rnn_ca2d.c
	gcc -lm -ffast-math -O3 $< -o $@ -ftree-vectorizer-verbose=1
rnn_ca2d-icc-O2: rnn_ca2d.c
	icc -vec-report1 -O2 $< -o $@
rnn_ca2d-icc-O3: rnn_ca2d.c
	icc -vec-report1 -O3 $< -o $@
rnn_ca2d-o64-O2: rnn_ca2d.c
	opencc -lm -ipa -O2 $< -o $@
rnn_ca2d-o64-O3: rnn_ca2d.c
	opencc -lm -ipa -O3 $< -o $@
rnn_ca2d-o64-Ofast: rnn_ca2d.c
	opencc -lm -ipa -Ofast $< -o $@

rnn_opt0-gcc-O2: rnn_opt0.c
	gcc -lm -ffast-math -O2 $< -o $@
rnn_opt0-gcc-O3: rnn_opt0.c
	gcc -lm -ffast-math -O3 $< -o $@ -ftree-vectorizer-verbose=1
rnn_opt0-icc-O2: rnn_opt0.c
	icc -vec-report1 -O2 $< -o $@
rnn_opt0-icc-O3: rnn_opt0.c
	icc -vec-report1 -O3 $< -o $@
rnn_opt0-o64-O2: rnn_opt0.c
	opencc -lm -ipa -O2 $< -o $@
rnn_opt0-o64-O3: rnn_opt0.c
	opencc -lm -ipa -O3 $< -o $@
rnn_opt0-o64-Ofast: rnn_opt0.c
	opencc -lm -ipa -Ofast $< -o $@

rnn_opt1-gcc-O2: rnn_opt1.c
	gcc -lm -ffast-math -O2 $< -o $@
rnn_opt1-gcc-O3: rnn_opt1.c
	gcc -lm -ffast-math -O3 $< -o $@ -ftree-vectorizer-verbose=1
rnn_opt1-icc-O2: rnn_opt1.c
	icc -vec-report1 -O2 $< -o $@
rnn_opt1-icc-O3: rnn_opt1.c
	icc -vec-report1 -O3 $< -o $@
rnn_opt1-o64-O2: rnn_opt1.c
	opencc -lm -ipa -O2 $< -o $@
rnn_opt1-o64-O3: rnn_opt1.c
	opencc -lm -ipa -O3 $< -o $@
rnn_opt1-o64-Ofast: rnn_opt1.c
	opencc -lm -ipa -Ofast $< -o $@

rnn_opt2-gcc-O2: rnn_opt2.c
	gcc -lm -ffast-math -O2 $< -o $@
rnn_opt2-gcc-O3: rnn_opt2.c
	gcc -lm -ffast-math -O3 $< -o $@ -ftree-vectorizer-verbose=1
rnn_opt2-icc-O2: rnn_opt2.c
	icc -vec-report1 -O2 $< -o $@
rnn_opt2-icc-O3: rnn_opt2.c
	icc -vec-report1 -O3 $< -o $@
rnn_opt2-o64-O2: rnn_opt2.c
	opencc -lm -ipa -O2 $< -o $@
rnn_opt2-o64-O3: rnn_opt2.c
	opencc -lm -ipa -O3 $< -o $@
rnn_opt2-o64-Ofast: rnn_opt2.c
	opencc -lm -ipa -Ofast $< -o $@

rnn_opt3-gcc-O2: rnn_opt3.c
	gcc -lm -ffast-math -O2 -std=c99 $< -o $@
rnn_opt3-gcc-O3: rnn_opt3.c
	gcc -lm -ffast-math -O3 -std=c99 $< -o $@ -ftree-vectorizer-verbose=1
rnn_opt3-icc-O2: rnn_opt3.c
	icc -vec-report1 -O2 -restrict $< -o $@
rnn_opt3-icc-O3: rnn_opt3.c
	icc -vec-report1 -O3 -restrict $< -o $@
rnn_opt3-o64-O2: rnn_opt3.c
	opencc -lm -ipa -std=c99 -O2 $< -o $@
rnn_opt3-o64-O3: rnn_opt3.c
	opencc -lm -ipa -std=c99 -O3 $< -o $@
rnn_opt3-o64-Ofast: rnn_opt3.c
	opencc -lm -ipa -std=c99 -Ofast $< -o $@

rnn_opt4-gcc-O2: rnn_opt4.c
	gcc -lm -ffast-math -O2 -std=c99 $< -o $@
rnn_opt4-gcc-O3: rnn_opt4.c
	gcc -lm -ffast-math -O3 -std=c99 $< -o $@ -ftree-vectorizer-verbose=1
rnn_opt4-icc-O2: rnn_opt4.c
	icc -vec-report1 -O2 -restrict $< -o $@
rnn_opt4-icc-O3: rnn_opt4.c
	icc -vec-report1 -O3 -restrict $< -o $@
rnn_opt4-o64-O2: rnn_opt4.c
	opencc -lm -ipa -std=c99 -O2 $< -o $@
rnn_opt4-o64-O3: rnn_opt4.c
	opencc -lm -ipa -std=c99 -O3 $< -o $@
rnn_opt4-o64-Ofast: rnn_opt4.c
	opencc -lm -ipa -std=c99 -Ofast $< -o $@

num_c=30
num_s=1000
repeat_times=300
#repeat_times=1

BENCHMARK = \
	for i in  $^; \
	do \
	printf "%s %d %d %d " \
	./$$i ${num_c} ${num_s} ${repeat_times} 1>&2; \
	time ./$$i ${num_c} ${num_s} ${repeat_times}; \
	done

# print command and time output to standard error
benchmark: ${ALL}
	${BENCHMARK}
benchmark-gcc: ${ALL_GCC}
	${BENCHMARK}
benchmark-icc: ${ALL_ICC}
	${BENCHMARK}
benchmark-o64: ${ALL_O64}
	${BENCHMARK}