From ad8831a83451fc9802a8438256e68e25df5c243d Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Thu, 11 Jul 2019 18:24:02 +0200 Subject: Premier jet du framework d'évaluation de perf (pas fini) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/monniaux/sandbox/Makefile | 118 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 test/monniaux/sandbox/Makefile (limited to 'test/monniaux/sandbox/Makefile') diff --git a/test/monniaux/sandbox/Makefile b/test/monniaux/sandbox/Makefile new file mode 100644 index 00000000..abc294dc --- /dev/null +++ b/test/monniaux/sandbox/Makefile @@ -0,0 +1,118 @@ +# This Makefile does not depend on ../rules.mk + +# You can modify ALL_CFILES to include the files that should be linked +ALL_CFILES=$(wildcard *.c) + +# Name of the target +TARGET=toto + +# Name of the clock object +CLOCK=../clock.gcc.k1c.o + +# Flags common to both compilers, then to gcc, then to ccomp +ALL_CFLAGS=-g -Wall -D__K1C_COS__ +ALL_GCCFLAGS=$(ALL_CFLAGS) -std=c99 -Wextra -Werror=implicit +ALL_CCOMPFLAGS=$(ALL_CFLAGS) + +# The compilers +K1C_CC=k1-cos-gcc +K1C_CCOMP=ccomp + +# Command to execute +EXECUTE_CYCLES=k1-cluster --syscall=libstd_scalls.so --cycle-based -- + +# You can define up to GCC4FLAGS and CCOMP4FLAGS +GCC0FLAGS=$(ALL_GCCFLAGS) -O0 +GCC1FLAGS=$(ALL_GCCFLAGS) -O1 +GCC2FLAGS=$(ALL_GCCFLAGS) -O2 +GCC3FLAGS=$(ALL_GCCFLAGS) -O3 +GCC4FLAGS= +CCOMP0FLAGS=$(ALL_CCOMPFLAGS) -O0 +CCOMP1FLAGS=$(ALL_CCOMPFLAGS) -fno-postpass +CCOMP2FLAGS=$(ALL_CCOMPFLAGS) +CCOMP3FLAGS= +CCOMP4FLAGS= + +# Prefix names +GCC0PREFIX=.gcc.o0 +GCC1PREFIX=.gcc.o1 +GCC2PREFIX=.gcc.o2 +GCC3PREFIX=.gcc.o3 +GCC4PREFIX= +CCOMP0PREFIX=.ccomp.o0 +CCOMP1PREFIX=.ccomp.o1 +CCOMP2PREFIX=.ccomp.o2 +CCOMP3PREFIX= +CCOMP4PREFIX= + +# List of outfiles, updated by gen_rules +OUTFILES:= + +firstrule: all + +# $1: compiler +# $2: compilation flags +# $3: extension prefix +define gen_rules + +%$(3).s: %.c + $(1) $(2) -S $$< -o $$@ + +$(TARGET)$(3).bin: $(ALL_CFILES:.c=$(3).o) $(CLOCK) + $(K1C_CC) $$+ -lm -o $$@ + +OUTFILES:=$(OUTFILES) $(TARGET)$(3).out +#OUTFILES=$(shell echo $(OUTFILES) $(TARGET)$(3).out) + +endef + +# Generic rules +%.o: %.s + $(K1C_CC) $< -c -o $@ + +%.out: %.bin + $(EXECUTE_CYCLES) $< | tee $@ + +## +# Generating the rules for all the compiler/flags.. +## + +ifneq ($(GCC0FLAGS),) +$(eval $(call gen_rules,$(K1C_CC),$(GCC0FLAGS),$(GCC0PREFIX))) +endif +ifneq ($(GCC1FLAGS),) +$(eval $(call gen_rules,$(K1C_CC),$(GCC1FLAGS),$(GCC1PREFIX))) +endif +ifneq ($(GCC2FLAGS),) +$(eval $(call gen_rules,$(K1C_CC),$(GCC2FLAGS),$(GCC2PREFIX))) +endif +ifneq ($(GCC3FLAGS),) +$(eval $(call gen_rules,$(K1C_CC),$(GCC3FLAGS),$(GCC3PREFIX))) +endif +ifneq ($(GCC4FLAGS),) +$(eval $(call gen_rules,$(K1C_CC),$(GCC4FLAGS),$(GCC4PREFIX))) +endif + +ifneq ($(CCOMP0FLAGS),) +$(eval $(call gen_rules,$(K1C_CCOMP),$(CCOMP0FLAGS),$(CCOMP0PREFIX))) +endif +ifneq ($(CCOMP1FLAGS),) +$(eval $(call gen_rules,$(K1C_CCOMP),$(CCOMP1FLAGS),$(CCOMP1PREFIX))) +endif +ifneq ($(CCOMP2FLAGS),) +$(eval $(call gen_rules,$(K1C_CCOMP),$(CCOMP2FLAGS),$(CCOMP2PREFIX))) +endif +ifneq ($(CCOMP3FLAGS),) +$(eval $(call gen_rules,$(K1C_CCOMP),$(CCOMP3FLAGS),$(CCOMP3PREFIX))) +endif +ifneq ($(CCOMP4FLAGS),) +$(eval $(call gen_rules,$(K1C_CCOMP),$(CCOMP4FLAGS),$(CCOMP4PREFIX))) +endif + +.PHONY: all clean +all: $(OUTFILES) + echo $(OUTFILES) + +clean: + rm -f *.o *.s *.bin *.out + -- cgit From 69fa20d6babe8f9cad978e55332f21f77f3bc964 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 12 Jul 2019 11:57:48 +0200 Subject: (#143) Mesure de cycles sur sandbox --- test/monniaux/sandbox/Makefile | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'test/monniaux/sandbox/Makefile') diff --git a/test/monniaux/sandbox/Makefile b/test/monniaux/sandbox/Makefile index abc294dc..11a179fc 100644 --- a/test/monniaux/sandbox/Makefile +++ b/test/monniaux/sandbox/Makefile @@ -1,4 +1,5 @@ # This Makefile does not depend on ../rules.mk +SHELL=bash # You can modify ALL_CFILES to include the files that should be linked ALL_CFILES=$(wildcard *.c) @@ -9,8 +10,11 @@ TARGET=toto # Name of the clock object CLOCK=../clock.gcc.k1c.o +# Maximum amount of time measures (see cycles.h) +MAX_MEASURES=10 + # Flags common to both compilers, then to gcc, then to ccomp -ALL_CFLAGS=-g -Wall -D__K1C_COS__ +ALL_CFLAGS=-g -Wall -D__K1C_COS__ -DMAX_MEASURES=$(MAX_MEASURES) ALL_GCCFLAGS=$(ALL_CFLAGS) -std=c99 -Wextra -Werror=implicit ALL_CCOMPFLAGS=$(ALL_CFLAGS) @@ -48,6 +52,9 @@ CCOMP4PREFIX= # List of outfiles, updated by gen_rules OUTFILES:= +# First line of the CSV file +FIRSTLINE:=benches + firstrule: all # $1: compiler @@ -62,7 +69,7 @@ $(TARGET)$(3).bin: $(ALL_CFILES:.c=$(3).o) $(CLOCK) $(K1C_CC) $$+ -lm -o $$@ OUTFILES:=$(OUTFILES) $(TARGET)$(3).out -#OUTFILES=$(shell echo $(OUTFILES) $(TARGET)$(3).out) +FIRSTLINE:=$(FIRSTLINE), $(3) endef @@ -109,9 +116,20 @@ ifneq ($(CCOMP4FLAGS),) $(eval $(call gen_rules,$(K1C_CCOMP),$(CCOMP4FLAGS),$(CCOMP4PREFIX))) endif +measures.csv: $(OUTFILES) + @echo $(FIRSTLINE) > $@ + @for ((i=0;i<=$(MAX_MEASURES);i++)) do\ + first=$$(grep "($$i) cycles" $(firstword $(OUTFILES)));\ + if test ! -z "$$first"; then\ + line="$(TARGET) $$i";\ + $(foreach outfile,$(OUTFILES),line="$$line, $$(grep "($$i) cycles" $(outfile) | cut -d':' -f2)"; ):;\ + echo "$$line" >> $@;\ + fi;\ + done;\ + echo "$@ created!" + .PHONY: all clean -all: $(OUTFILES) - echo $(OUTFILES) +all: measures.csv clean: rm -f *.o *.s *.bin *.out -- cgit From 4f6fd68084b4d3a7544e166b2c24524464efb626 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 12 Jul 2019 12:13:18 +0200 Subject: (#143) intermediate files are not deleted --- test/monniaux/sandbox/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/monniaux/sandbox/Makefile') diff --git a/test/monniaux/sandbox/Makefile b/test/monniaux/sandbox/Makefile index 11a179fc..f753b87c 100644 --- a/test/monniaux/sandbox/Makefile +++ b/test/monniaux/sandbox/Makefile @@ -62,9 +62,11 @@ firstrule: all # $3: extension prefix define gen_rules +.SECONDARY: %$(3).s: %.c $(1) $(2) -S $$< -o $$@ +.SECONDARY: $(TARGET)$(3).bin: $(ALL_CFILES:.c=$(3).o) $(CLOCK) $(K1C_CC) $$+ -lm -o $$@ -- cgit From 5eb05f7f598621f0781900c21a9f210d74651f95 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 12 Jul 2019 14:45:38 +0200 Subject: (#143) - Regrouping in obj/ asm/ bin/ directories --- test/monniaux/sandbox/Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'test/monniaux/sandbox/Makefile') diff --git a/test/monniaux/sandbox/Makefile b/test/monniaux/sandbox/Makefile index f753b87c..fdb24685 100644 --- a/test/monniaux/sandbox/Makefile +++ b/test/monniaux/sandbox/Makefile @@ -63,23 +63,27 @@ firstrule: all define gen_rules .SECONDARY: -%$(3).s: %.c +asm/%$(3).s: %.c + @mkdir -p $$(@D) $(1) $(2) -S $$< -o $$@ .SECONDARY: -$(TARGET)$(3).bin: $(ALL_CFILES:.c=$(3).o) $(CLOCK) +bin/$(TARGET)$(3).bin: $(addprefix obj/,$(ALL_CFILES:.c=$(3).o)) $(CLOCK) + @mkdir -p $$(@D) $(K1C_CC) $$+ -lm -o $$@ -OUTFILES:=$(OUTFILES) $(TARGET)$(3).out +OUTFILES:=$(OUTFILES) out/$(TARGET)$(3).out FIRSTLINE:=$(FIRSTLINE), $(3) endef # Generic rules -%.o: %.s +obj/%.o: asm/%.s + @mkdir -p $(@D) $(K1C_CC) $< -c -o $@ -%.out: %.bin +out/%.out: bin/%.bin + @mkdir -p $(@D) $(EXECUTE_CYCLES) $< | tee $@ ## -- cgit From 151307bc11cff63a5b026a4a8b0807bb6280b937 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 12 Jul 2019 17:39:18 +0200 Subject: (#143) More features --- test/monniaux/sandbox/Makefile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'test/monniaux/sandbox/Makefile') diff --git a/test/monniaux/sandbox/Makefile b/test/monniaux/sandbox/Makefile index fdb24685..0fa2a2ae 100644 --- a/test/monniaux/sandbox/Makefile +++ b/test/monniaux/sandbox/Makefile @@ -14,7 +14,8 @@ CLOCK=../clock.gcc.k1c.o MAX_MEASURES=10 # Flags common to both compilers, then to gcc, then to ccomp -ALL_CFLAGS=-g -Wall -D__K1C_COS__ -DMAX_MEASURES=$(MAX_MEASURES) +ALL_CFLAGS=-Wall -D__K1C_COS__ -DMAX_MEASURES=$(MAX_MEASURES) +#ALL_CFLAGS+=-g ALL_GCCFLAGS=$(ALL_CFLAGS) -std=c99 -Wextra -Werror=implicit ALL_CCOMPFLAGS=$(ALL_CFLAGS) @@ -26,19 +27,19 @@ K1C_CCOMP=ccomp EXECUTE_CYCLES=k1-cluster --syscall=libstd_scalls.so --cycle-based -- # You can define up to GCC4FLAGS and CCOMP4FLAGS -GCC0FLAGS=$(ALL_GCCFLAGS) -O0 +GCC0FLAGS= GCC1FLAGS=$(ALL_GCCFLAGS) -O1 GCC2FLAGS=$(ALL_GCCFLAGS) -O2 GCC3FLAGS=$(ALL_GCCFLAGS) -O3 GCC4FLAGS= -CCOMP0FLAGS=$(ALL_CCOMPFLAGS) -O0 +CCOMP0FLAGS= CCOMP1FLAGS=$(ALL_CCOMPFLAGS) -fno-postpass CCOMP2FLAGS=$(ALL_CCOMPFLAGS) CCOMP3FLAGS= CCOMP4FLAGS= # Prefix names -GCC0PREFIX=.gcc.o0 +GCC0PREFIX= GCC1PREFIX=.gcc.o1 GCC2PREFIX=.gcc.o2 GCC3PREFIX=.gcc.o3 @@ -51,6 +52,7 @@ CCOMP4PREFIX= # List of outfiles, updated by gen_rules OUTFILES:= +BINFILES:= # First line of the CSV file FIRSTLINE:=benches @@ -72,6 +74,7 @@ bin/$(TARGET)$(3).bin: $(addprefix obj/,$(ALL_CFILES:.c=$(3).o)) $(CLOCK) @mkdir -p $$(@D) $(K1C_CC) $$+ -lm -o $$@ +BINFILES:=$(BINFILES) bin/$(TARGET)$(3).bin OUTFILES:=$(OUTFILES) out/$(TARGET)$(3).out FIRSTLINE:=$(FIRSTLINE), $(3) @@ -134,9 +137,12 @@ measures.csv: $(OUTFILES) done;\ echo "$@ created!" -.PHONY: all clean -all: measures.csv +.PHONY: all clean run +all: $(BINFILES) + +run: measures.csv clean: rm -f *.o *.s *.bin *.out + rm -f asm/*.s bin/*.bin obj/*.o out/*.out -- cgit