CFLAGS?=-Wall -Wextra ifeq ($(shell perf --help 2>/dev/null >/dev/null && echo y),y) runntimes = perf stat -r $(1) $(2) runntimesandlog = script -a -q -c "$(runntimes)" $(3) else # Run a command several times # @param N Number of time to run the command # @param cmd Command to run # @result Run command cmd N times runntimes = for runi in $$(seq $(1)) ; do time $(2) ; done runntimesandlog = touch $(3) ; { $(runntimes) } >>$(3) 2>&1 endif test: $(call runntimes,5,echo toto) $(call runntimesandlog,5,echo toto,tototest) all: allfmr alllattice alltemplate allfmr: fmr_omp-str_base-prog fmr_omp-str_base-prog-fopenmp alllattice: lattice-prog-1 lattice-prog-fopenmp-2 lattice-prog-fopenmp-4 lattice-prog-fopenmp-8 lattice-prog-fopenmp-12 alltemplate: pipeline_template-prog-1 pipeline_template-prog-fopenmp-2 pipeline_template-prog-fopenmp-4 pipeline_template-prog-fopenmp-8 pipeline_template-prog-fopenmp-12 runall: runallfmr runalllattice runalltemplate runallfmr: runfmrprog runfmrprog-fopenmp runalllattice: runlatticeprog-1 runlatticeprog-fopenmp-2 runlatticeprog-fopenmp-4 runlatticeprog-fopenmp-8 runlatticeprog-fopenmp-12 runalltemplate: runtemplateprog-1 runtemplateprog-fopenmp-2 runtemplateprog-fopenmp-4 runtemplateprog-fopenmp-8 runtemplateprog-fopenmp-12 fmr_omp-str_base-%: fmr_omp-str_base.c gcc $(CFLAGS) $(subst prog,,$*) -o $@ $< -lm runfmr%: fmr_omp-str_base-% mkdir -p logs ./$< input_20.dat 2>/dev/null $(call runntimesandlog,10,./$< input_20.dat,logs/$<-$$(date +%Y-%m-%d_%H-%M-%S).log) rm fmr_omp-str_base-$*.txt lattice-prog-%: lattice.c NUM=$*;OPT=-$*;gcc $(CFLAGS) -DNB_CORES=$${NUM##*-} $${OPT%-*} -o $@ $< runlattice%: lattice-% mkdir -p logs ./$< -p 10000 2>/dev/null $(call runntimesandlog,10,./$< -p 10000,logs/$<-$$(date +%Y-%m-%d_%H-%M-%S).log) pipeline_template-prog-%: pipeline_template.c NUM=$*;OPT=-$*;gcc $(CFLAGS) -DNB_CORES=$${NUM##*-} $${OPT%-*} -o $@ $< -lrt runtemplate%: pipeline_template-% mkdir -p logs ./$< -p 10000 2>/dev/null $(call runntimesandlog,10,./$< -p 10000 -s 480000,logs/$<-$$(date +%Y-%m-%d_%H-%M-%S).log) .PHONY: all allfmr alllattice runall runfmr runfmr% runlattice runlattice%