更新 PGO profdata 并为 ABE 插桩编译添加 PGO_MODE 开关
- 更新 pgo_profile/default.profdata 为最新收集的 profile 数据 - 备份旧 profdata 至 default.profdata.backup2 - makefile: 新增 PGO_MODE 开关(默认 opt),支持 make PGO_MODE=instrument 切换到 Phase 1 插桩模式重新收集数据,无需手动修改 flags - makefile: TwoPunctureABE 独立使用 TP_OPTFLAGS,不受 PGO_MODE 影响 - makefile: PROFDATA 路径改为 /home/$(shell whoami)/AMSS-NCKU/pgo_profile/default.profdata - makefile.inc: 移除硬编码的编译 flags,改由 makefile 中的 ifeq 逻辑管理 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,27 @@
|
|||||||
|
|
||||||
include makefile.inc
|
include makefile.inc
|
||||||
|
|
||||||
|
## ABE build flags selected by PGO_MODE (set in makefile.inc, default: opt)
|
||||||
|
## make -> opt (PGO-guided, maximum performance)
|
||||||
|
## make PGO_MODE=instrument -> instrument (Phase 1: collect fresh profile data)
|
||||||
|
PROFDATA = /home/$(shell whoami)/AMSS-NCKU/pgo_profile/default.profdata
|
||||||
|
|
||||||
|
ifeq ($(PGO_MODE),instrument)
|
||||||
|
## Phase 1: instrumentation — omit -ipo/-fp-model fast=2 for faster build and numerical stability
|
||||||
|
CXXAPPFLAGS = -O2 -xHost -fma -fprofile-instr-generate \
|
||||||
|
-Dfortran3 -Dnewc -I${MKLROOT}/include
|
||||||
|
f90appflags = -O2 -xHost -fma -fprofile-instr-generate \
|
||||||
|
-align array64byte -fpp -I${MKLROOT}/include
|
||||||
|
else
|
||||||
|
## opt (default): maximum performance with PGO profile data
|
||||||
|
CXXAPPFLAGS = -O3 -xHost -fp-model fast=2 -fma -ipo \
|
||||||
|
-fprofile-instr-use=$(PROFDATA) \
|
||||||
|
-Dfortran3 -Dnewc -I${MKLROOT}/include
|
||||||
|
f90appflags = -O3 -xHost -fp-model fast=2 -fma -ipo \
|
||||||
|
-fprofile-instr-use=$(PROFDATA) \
|
||||||
|
-align array64byte -fpp -I${MKLROOT}/include
|
||||||
|
endif
|
||||||
|
|
||||||
.SUFFIXES: .o .f90 .C .for .cu
|
.SUFFIXES: .o .f90 .C .for .cu
|
||||||
|
|
||||||
.f90.o:
|
.f90.o:
|
||||||
@@ -16,11 +37,14 @@ include makefile.inc
|
|||||||
.cu.o:
|
.cu.o:
|
||||||
$(Cu) $(CUDA_APP_FLAGS) -c $< -o $@ $(CUDA_LIB_PATH)
|
$(Cu) $(CUDA_APP_FLAGS) -c $< -o $@ $(CUDA_LIB_PATH)
|
||||||
|
|
||||||
|
## TwoPunctureABE uses fixed optimal flags, independent of CXXAPPFLAGS (which may be PGO-instrumented)
|
||||||
|
TP_OPTFLAGS = -O3 -xHost -fp-model fast=2 -fma -ipo -Dfortran3 -Dnewc -I${MKLROOT}/include
|
||||||
|
|
||||||
TwoPunctures.o: TwoPunctures.C
|
TwoPunctures.o: TwoPunctures.C
|
||||||
${CXX} $(CXXAPPFLAGS) -qopenmp -c $< -o $@
|
${CXX} $(TP_OPTFLAGS) -qopenmp -c $< -o $@
|
||||||
|
|
||||||
TwoPunctureABE.o: TwoPunctureABE.C
|
TwoPunctureABE.o: TwoPunctureABE.C
|
||||||
${CXX} $(CXXAPPFLAGS) -qopenmp -c $< -o $@
|
${CXX} $(TP_OPTFLAGS) -qopenmp -c $< -o $@
|
||||||
|
|
||||||
# Input files
|
# Input files
|
||||||
C++FILES = ABE.o Ansorg.o Block.o misc.o monitor.o Parallel.o MPatch.o var.o\
|
C++FILES = ABE.o Ansorg.o Block.o misc.o monitor.o Parallel.o MPatch.o var.o\
|
||||||
@@ -102,7 +126,7 @@ ABEGPU: $(C++FILES_GPU) $(F90FILES) $(F77FILES) $(AHFDOBJS) $(CUDAFILES)
|
|||||||
$(CLINKER) $(CXXAPPFLAGS) -o $@ $(C++FILES_GPU) $(F90FILES) $(F77FILES) $(AHFDOBJS) $(CUDAFILES) $(LDLIBS)
|
$(CLINKER) $(CXXAPPFLAGS) -o $@ $(C++FILES_GPU) $(F90FILES) $(F77FILES) $(AHFDOBJS) $(CUDAFILES) $(LDLIBS)
|
||||||
|
|
||||||
TwoPunctureABE: $(TwoPunctureFILES)
|
TwoPunctureABE: $(TwoPunctureFILES)
|
||||||
$(CLINKER) $(CXXAPPFLAGS) -qopenmp -o $@ $(TwoPunctureFILES) $(LDLIBS)
|
$(CLINKER) $(TP_OPTFLAGS) -qopenmp -o $@ $(TwoPunctureFILES) $(LDLIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.o ABE ABEGPU TwoPunctureABE make.log -f
|
rm *.o ABE ABEGPU TwoPunctureABE make.log -f
|
||||||
|
|||||||
@@ -10,16 +10,10 @@ filein = -I/usr/include/ -I${MKLROOT}/include
|
|||||||
## Added -lifcore for Intel Fortran runtime and -limf for Intel math library
|
## Added -lifcore for Intel Fortran runtime and -limf for Intel math library
|
||||||
LDLIBS = -L${MKLROOT}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lifcore -limf -lpthread -lm -ldl
|
LDLIBS = -L${MKLROOT}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lifcore -limf -lpthread -lm -ldl
|
||||||
|
|
||||||
## Aggressive optimization flags + PGO Phase 2 (profile-guided optimization)
|
## PGO build mode switch (ABE only; TwoPunctureABE always uses opt flags)
|
||||||
## -fprofile-instr-use: use collected profile data to guide optimization decisions
|
## opt : (default) maximum performance with PGO profile-guided optimization
|
||||||
## (branch prediction, basic block layout, inlining, loop unrolling)
|
## instrument : PGO Phase 1 instrumentation to collect fresh profile data
|
||||||
PROFDATA = ../../pgo_profile/default.profdata
|
PGO_MODE ?= opt
|
||||||
CXXAPPFLAGS = -O3 -xHost -fp-model fast=2 -fma -ipo \
|
|
||||||
-fprofile-instr-use=$(PROFDATA) \
|
|
||||||
-Dfortran3 -Dnewc -I${MKLROOT}/include
|
|
||||||
f90appflags = -O3 -xHost -fp-model fast=2 -fma -ipo \
|
|
||||||
-fprofile-instr-use=$(PROFDATA) \
|
|
||||||
-align array64byte -fpp -I${MKLROOT}/include
|
|
||||||
f90 = ifx
|
f90 = ifx
|
||||||
f77 = ifx
|
f77 = ifx
|
||||||
CXX = icpx
|
CXX = icpx
|
||||||
|
|||||||
Binary file not shown.
BIN
pgo_profile/default.profdata.backup2
Normal file
BIN
pgo_profile/default.profdata.backup2
Normal file
Binary file not shown.
BIN
pgo_profile/default_9725923726611433605_0.profraw
Normal file
BIN
pgo_profile/default_9725923726611433605_0.profraw
Normal file
Binary file not shown.
Reference in New Issue
Block a user