Add C kernel for BSSN-EM (Maxwell/electromagnetic field) RHS computation
New bssn_em_rhs_c.C computes EM field RHS (E,B,Kpsi,Kphi) and stress-energy tensor, then calls the C BSSN RHS kernel with source terms. Replaces empart.f90 when USE_CXX_EM_KERNEL=1. Supports all ghost_width orders via existing derivative kernels. Controlled by USE_CXX_EM_KERNEL switch (default 0, experimental). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,24 @@ $(error USE_CXX_ESCALAR_KERNEL=1 requires USE_CXX_KERNELS=1 because bssn_escalar
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(USE_CXX_EM_KERNEL),1)
|
||||
ifeq ($(ABE_TYPE),3)
|
||||
EFFECTIVE_USE_CXX_EM_KERNEL = 1
|
||||
else
|
||||
EFFECTIVE_USE_CXX_EM_KERNEL = 0
|
||||
endif
|
||||
else
|
||||
EFFECTIVE_USE_CXX_EM_KERNEL = 0
|
||||
endif
|
||||
|
||||
ifeq ($(EFFECTIVE_USE_CXX_EM_KERNEL),1)
|
||||
ifeq ($(USE_CXX_KERNELS),0)
|
||||
$(error USE_CXX_EM_KERNEL=1 requires USE_CXX_KERNELS=1 because bssn_em_rhs_c.C reuses the C BSSN kernel)
|
||||
endif
|
||||
endif
|
||||
|
||||
EM_KERNEL_FLAG = -DBSSN_USE_EM_C_KERNEL=$(EFFECTIVE_USE_CXX_EM_KERNEL)
|
||||
|
||||
## polint(ordn=6) kernel selector:
|
||||
## 1 (default): barycentric fast path
|
||||
## 0 : fallback to Neville path
|
||||
@@ -44,11 +62,6 @@ ESCALAR_KERNEL_FLAG = -DBSSN_USE_ESCALAR_C_KERNEL=$(EFFECTIVE_USE_CXX_ESCALAR_KE
|
||||
## make -> opt (PGO-guided, maximum performance)
|
||||
## make PGO_MODE=instrument -> instrument (Phase 1: collect fresh profile data)
|
||||
|
||||
CXXAPPFLAGS = -O3 -march=znver4 -ffast-math -flto \
|
||||
-Dfortran3 -Dnewc -I$(AOCL_ROOT)/include $(INTERP_LB_FLAGS) \
|
||||
$(TRANSFER_CACHE_FLAG) $(ESCALAR_KERNEL_FLAG) $(EM_KERNEL_FLAG)
|
||||
f90appflags = -O3 -march=znver4 -ffast-math -flto \
|
||||
-cpp -I$(AOCL_ROOT)/include $(POLINT6_FLAG)
|
||||
|
||||
.SUFFIXES: .o .f90 .C .for .cu
|
||||
|
||||
@@ -103,6 +116,9 @@ fdderivs_shc_c.o: fdderivs_shc_c.C
|
||||
kodiss_sh_c.o: kodiss_sh_c.C
|
||||
$(CXX) $(CXXAPPFLAGS) -c $< $(filein) -o $@
|
||||
|
||||
|
||||
bssn_em_rhs_c.o: bssn_em_rhs_c.C
|
||||
$(CXX) $(CXXAPPFLAGS) -c $< $(filein) -o $@
|
||||
z4c_rhs_c.o: z4c_rhs_c.C
|
||||
$(CXX) $(CXXAPPFLAGS) -c $< $(filein) -o $@
|
||||
|
||||
@@ -113,7 +129,7 @@ z4c_rhs_c.o: z4c_rhs_c.C
|
||||
TP_PROFDATA = /home/$(shell whoami)/AMSS-NCKU/pgo_profile/TwoPunctureABE.profdata
|
||||
TP_OPTFLAGS = -O3 -xHost -fp-model fast=2 -fma -ipo \
|
||||
-fprofile-instr-use=$(TP_PROFDATA) \
|
||||
-Dfortran3 -Dnewc -I${MKLROOT}/include
|
||||
-Dfortran3 -Dnewc -I$(AOCL_ROOT)/include
|
||||
|
||||
TwoPunctures.o: TwoPunctures.C
|
||||
$(CXX) $(TP_OPTFLAGS) -qopenmp -c $< -o $@
|
||||
@@ -133,6 +149,9 @@ CFILES = bssn_rhs_c.o fderivs_c.o fdderivs_c.o kodiss_c.o lopsided_c.o lopsided_
|
||||
ifeq ($(EFFECTIVE_USE_CXX_ESCALAR_KERNEL),1)
|
||||
CFILES += bssn_escalar_rhs_c.o
|
||||
endif
|
||||
ifeq ($(EFFECTIVE_USE_CXX_EM_KERNEL),1)
|
||||
CFILES += bssn_em_rhs_c.o
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(USE_CXX_Z4C_KERNELS),1)
|
||||
|
||||
Reference in New Issue
Block a user