Fix Compile_Constraint/analysis use CPU Fortran for shell RHS

Limit GPU shell RHS redirection to Step and SHStep only via #define/#undef.
Compute_Constraint, Interp_Constraint, and Constraint_Out continue using
the CPU Fortran path to avoid GPU alloc-per-call overhead during
initialization and analysis phases.

Also: wrap compare_result_gpu in #ifdef RESULT_CHECK to avoid link error.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 19:25:45 +08:00
parent bd4ce3fbf3
commit fbb2ed112d

View File

@@ -98,7 +98,9 @@ static int cuda_compute_rhs_bssn_ss(
Symmetry, Lev, eps, sst, co); Symmetry, Lev, eps, sst, co);
} }
} }
// All call sites below that use f_compute_rhs_bssn_ss get redirected to GPU // Use GPU for shell RHS in Step and SHStep.
// Compute_Constraint / Interp_Constraint / Constraint_Out keep
// CPU Fortran (GPU alloc-per-call overhead dominates there).
#define f_compute_rhs_bssn_ss cuda_compute_rhs_bssn_ss #define f_compute_rhs_bssn_ss cuda_compute_rhs_bssn_ss
#endif #endif
@@ -9066,6 +9068,12 @@ void bssn_class::AnalysisStuff(int lev, double dT_lev)
//================================================================================================ //================================================================================================
#if USE_CUDA_BSSN && defined(WithShell)
#undef f_compute_rhs_bssn_ss
// Restore the original Fortran name mapping from bssn_rhs.h (fortran3 convention)
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss_
#endif
// This member function computes and outputs constraint violations // This member function computes and outputs constraint violations
//================================================================================================ //================================================================================================