1 Star 0 Fork 0

HuWen/run_spec2006

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile.base 7.12 KB
一键复制 编辑 原始数据 按行查看 历史
HuWen 提交于 2022-08-26 16:52 . init with run_spec2017
ifndef MAPLE_ROOT
$(error MAPLE_ROOT is not set. Please source zeiss/envsetup.sh to set the build environment)
endif
ifndef SPEC
$(error SPEC is not set. Please follow README to source envsetup.sh to set the spec environment)
endif
ifndef ARCH
$(error ARCH is not set. Please follow README to source envsetup.sh to set the ARCH environment)
endif
ifndef TYPE
$(error TYPE is not set. Please follow README to source envsetup.sh to set the TYPE environment)
endif
# required vars
# BENCHMARK :=
# USE_SRC :=
# TARGET :=
# FLAGS :=
# LINK_FLAGS :=
# LST :=
RUN_SPEC_DIR := $(MAPLE_ROOT)/../run_spec2017
BENCHMARK_DIR := $(RUN_SPEC_DIR)/$(BENCHMARK)
C2ASM := $(RUN_SPEC_DIR)/c2asm.sh
CHECK := $(RUN_SPEC_DIR)/check_results.sh
FIXSRC := $(RUN_SPEC_DIR)/fixsrc.sh
LINARO=$(MAPLE_ROOT)/tools/gcc-linaro-7.5.0
ifeq ($(ARCH), maplearm)
GCC := $(LINARO)/bin/aarch64-linux-gnu-gcc
else ifeq ($(ARCH), x86arm)
GCC := $(LINARO)/bin/aarch64-linux-gnu-gcc
else ifeq ($(ARCH), mapleriscv)
GCC := /usr/riscv64-linux-gnu/bin/riscv64-unknown-linux-gnu-gcc
else ifeq ($(ARCH), x86riscv)
GCC := /usr/riscv64-linux-gnu/bin/riscv64-unknown-linux-gnu-gcc
else
GCC := /usr/bin/gcc
endif
OUT := out
SPEC_SRC := $(SPEC)/benchspec/CPU/$(USE_SRC)/src
SRCS := $(addprefix $(OUT)/, $(LST))
ASMS_MAPLEARM := $(SRCS:.c=.maplearm.s)
OBJS_MAPLEARM := $(SRCS:.c=.maplearm.o)
OBJS_X86 := $(SRCS:.c=.x86.o)
OBJS_X86ARM := $(SRCS:.c=.x86arm.o)
OBJS_ARM := $(SRCS:.c=.arm.o)
ASMS_MAPLERISCV := $(SRCS:.c=.mapleriscv.s)
OBJS_MAPLERISCV := $(SRCS:.c=.mapleriscv.o)
OBJS_RISCV := $(SRCS:.c=.riscv.o)
OBJS_X86RISCV := $(SRCS:.c=.x86riscv.o)
# disable openmp till FE is ready
FLAGS_ARM += -DSPEC_AUTO_SUPPRESS_OPENMP
FLAGS_RISCV += -DSPEC_AUTO_SUPPRESS_OPENMP
FLAGS_MAPLE += -DSPEC_AUTO_SUPPRESS_OPENMP
ifeq ("maple", $(filter "maple",$(ARCH)))
ifndef MAPLE_ROOT
$(error MAPLE_ROOT is not set. Please source zeiss/envsetup.sh to set the build environment)
endif
ifndef MAPLE_PRODUCT_EXECUTABLE
$(error MAPLE_PRODUCT_EXECUTABLE is not set. Please source zeiss/envsetup.sh to set the build environment)
endif
endif
MISC =
ifeq ($(ARCH), x86)
OBJS = $(OBJS_X86)
FLAGS = $(FLAGS_X86)
LINK_FLAGS = $(LINK_FLAGS_X86)
else ifeq ($(ARCH), x86arm)
OBJS = $(OBJS_X86ARM)
FLAGS = $(FLAGS_ARM)
LINK_FLAGS = $(LINK_FLAGS_ARM)
RUN_INVOKER = $(MAPLE_ROOT)/tools/bin/qemu-aarch64 -L $(LINARO)/aarch64-linux-gnu/libc
else ifeq ($(ARCH), arm)
OBJS = $(OBJS_ARM)
FLAGS = $(FLAGS_ARM)
LINK_FLAGS = $(LINK_FLAGS_ARM)
else ifeq ($(ARCH), maplearm)
OBJS = $(OBJS_MAPLEARM)
FLAGS = $(FLAGS_MAPLE)
LINK_FLAGS =
RUN_INVOKER = $(MAPLE_ROOT)/tools/bin/qemu-aarch64 -L $(LINARO)/aarch64-linux-gnu/libc
MISC += $(SRCS:.c=.maplearm.c) $(SRCS:.c=.maplearm.s) $(SRCS:.c=.maplearm.B) $(SRCS:.c=.maplearm.bpl)
else ifeq ($(ARCH), mapleriscv)
OBJS = $(OBJS_MAPLERISCV)
FLAGS = $(FLAGS_MAPLE)
LINK_FLAGS =
RUN_INVOKER = LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/sysroot/lib qemu-riscv64
MISC += $(SRCS:.c=.mapleriscv.c) $(SRCS:.c=.mapleriscv.s) $(SRCS:.c=.mapleriscv.B) $(SRCS:.c=.mapleriscv.bpl)
else ifeq ($(ARCH), riscv)
OBJS = $(OBJS_RISCV)
FLAGS = $(FLAGS_RISCV)
LINK_FLAGS = $(LINK_FLAGS_RISCV)
else ifeq ($(ARCH), x86riscv)
OBJS = $(OBJS_X86RISCV)
FLAGS = $(FLAGS_RISCV)
LINK_FLAGS = $(LINK_FLAGS_RISCV)
RUN_INVOKER = LD_LIBRARY_PATH=/usr/riscv64-linux-gnu/sysroot/lib qemu-riscv64
endif
EXE := $(TARGET).$(ARCH)
.SECONDARY: $(ASMS_MAPLEARM)
.SECONDARY: $(ASMS_MAPLERISCV)
help:
@echo "================================================================"
@echo " make setupall"
@echo " make buildall"
@echo " make runall/runtestall/runtrainall/runrefspeed/.."
@echo " make checkall -- or use ./run.sh maplearm 1"
@echo " "
@echo " on arm server, you can use runnative flavors:"
@echo " make runnativeall"
@echo " make runnativetrainall"
@echo " make runnativerefspeedall"
@echo " "
@echo " in individual benchmarks, you can use similar command with all"
@echo " make setup"
@echo " make build"
@echo " make run - will run both test and train tests"
@echo " make check"
@echo "================================================================"
.PHONY: setup
setup:
mkdir -p $(BENCHMARK_DIR)/$(OUT)
cp -fr $(SPEC_SRC)/* $(BENCHMARK_DIR)/$(OUT)
$(FIXSRC) $(BENCHMARK)
.PHONY: fixsrc
fixsrc:
$(FIXSRC) $(BENCHMARK)
build: $(EXE)
z:
@echo ARCH=$(ARCH)
@echo EXE=$(EXE)
@echo MAPLE_PRODUCT_EXECUTABLE=$(MAPLE_PRODUCT_EXECUTABLE)
@echo GCC=$(GCC)
@echo SRCS=$(SRCS)
@echo OBJS=$(OBJS)
%.maplearm.o : %.maplearm.s
$(GCC) -o $@ -c $<
%.maplearm.s : %.c
bash -x $(C2ASM) arm $< $(FLAGS)
%.mapleriscv.o : %.mapleriscv.s
$(GCC) -o $@ -c $<
%.mapleriscv.s : %.c
bash -x $(C2ASM) riscv $< $(FLAGS)
riscvasm : $(ASMS_MAPLERISCV)
%.x86.o : %.c
$(GCC) -o $@ -c $< $(FLAGS)
%.x86arm.o : %.c
$(GCC) -o $@ -c $< $(FLAGS)
%.arm.o : %.c
$(GCC) -o $@ -c $< $(FLAGS)
%.x86riscv.o : %.c
$(GCC) -o $@ -c $< $(FLAGS)
%.riscv.o : %.c
$(GCC) -o $@ -c $< $(FLAGS)
$(EXE) : $(OBJS)
$(GCC) -o $@ $(OBJS) $(LINK_FLAGS) -lm
.PHONY: run
run: runtest runtrain
.PHONY: runref
runref: runrefspeed runrefrate
.PHONY: runnative
runnative: runnativetest runnativetrain
.PHONY: runnativeref
runnativeref: runnativerefspeed runnativerefrate
.PHONY: runtest
runtest:
$(foreach R,$(RUN_TST),$(RUN_INVOKER) $(EXE) $($R);)
$(foreach R,$(RUN_TST_600),(cd out; $(RUN_INVOKER) ../$(EXE) $($R));)
$(foreach R,$(RUN_TST_625),(mkdir -p out/$(R)_$(ARCH); cd out/$(R)_$(ARCH); $(RUN_INVOKER) ../../$(EXE) $($R));)
.PHONY: runtrain
runtrain:
$(foreach R,$(RUN_TRN),$(RUN_INVOKER) $(EXE) $($R);)
$(foreach R,$(RUN_TRN_625),(mkdir -p out/$(R)_$(ARCH); cd out/$(R)_$(ARCH); $(RUN_INVOKER) ../../$(EXE) $($R));)
.PHONY: runrefspeed
runrefspeed:
$(foreach R,$(RUN_REFS),$(RUN_INVOKER) $(EXE) $($R);)
$(foreach R,$(RUN_REFS_625),(mkdir -p out/$(R)_$(ARCH); cd out/$(R)_$(ARCH); $(RUN_INVOKER) ../../$(EXE) $($R));)
.PHONY: runrefrate
runrefrate:
$(foreach R,$(RUN_REFR),$(RUN_INVOKER) $(EXE) $($R);)
.PHONY: runnativetest
runnativetest:
$(foreach R,$(RUN_TST),./$(EXE) $($R);)
$(foreach R,$(RUN_TST_600),(cd out; ../$(EXE) $($R));)
$(foreach R,$(RUN_TST_625),(mkdir -p out/$(R)_$(ARCH); cd out/$(R)_$(ARCH); ../../$(EXE) $($R));)
.PHONY: runnativetrain
runnativetrain:
$(foreach R,$(RUN_TRN),./$(EXE) $($R);)
$(foreach R,$(RUN_TRN_625),(mkdir -p out/$(R)_$(ARCH); cd out/$(R)_$(ARCH); ../../$(EXE) $($R));)
.PHONY: runnativerefspeed
runnativerefspeed:
$(foreach R,$(RUN_REFS),./$(EXE) $($R);)
$(foreach R,$(RUN_REFS_625),(mkdir -p out/REFS_$(ARCH); cd out/REFS_$(ARCH); ../../$(EXE) $($R));)
.PHONY: runnativerefrate
runnativerefrate:
$(foreach R,$(RUN_REFR),./$(EXE) $($R);)
.PHONY: check
check: checktest checktrain
.PHONY: checktest
checktest:
$(CHECK) $(BENCHMARK) test
.PHONY: checktrain
checktrain:
$(CHECK) $(BENCHMARK) train
.PHONY: checkrefspeed
checkrefspeed:
$(CHECK) $(BENCHMARK) refspeed
.PHONY: checkrefrate
checkrefrate:
$(CHECK) $(BENCHMARK) refrate
.PHONY: checkref
checkref: checkrefspeed checkrefrate
.PHONY: checkall
checkall: checktest checktrain checkrefspeed checkrefrate
.PHONY: clean
clean:
rm -rf $(OBJS) $(EXE) $(MISC)
.PHONY: realclean
realclean: clean
rm -rf $(OUT) $(TARGET)* $(EXTRA_FILES)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/hu-_-wen/run_spec2006.git
git@gitee.com:hu-_-wen/run_spec2006.git
hu-_-wen
run_spec2006
run_spec2006
master

搜索帮助