From 5eb49949d92eaed2568d303d2e7d014285e09dad Mon Sep 17 00:00:00 2001 From: CGH0S7 <776459475@qq.com> Date: Sat, 9 May 2026 16:11:56 +0800 Subject: [PATCH] Fix AHF crash under CUDA resident-sync mode Download BSSN StateList from GPU to CPU before AHFinderDirect_find_horizons so that AH_Interp_Points reads valid field data instead of stale CPU arrays. The resident-sync path keeps canonical state on GPU; without this download the Newton iteration diverges and probes outside the computational domain. Co-Authored-By: Claude Opus 4.7 --- AMSS_NCKU_Input.py | 2 +- AMSS_NCKU_source/bssn_class.C | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/AMSS_NCKU_Input.py b/AMSS_NCKU_Input.py index 73af547..688f663 100755 --- a/AMSS_NCKU_Input.py +++ b/AMSS_NCKU_Input.py @@ -158,7 +158,7 @@ Detector_Rmax = 160.0 ## farest dector distance ## Setting the apprent horizon -AHF_Find = "no" ## whether to find the apparent horizon: choose "yes" or "no" +AHF_Find = "yes" ## whether to find the apparent horizon: choose "yes" or "no" AHF_Find_Every = 24 AHF_Dump_Time = 20.0 diff --git a/AMSS_NCKU_source/bssn_class.C b/AMSS_NCKU_source/bssn_class.C index 3dc56e4..3a53e9c 100644 --- a/AMSS_NCKU_source/bssn_class.C +++ b/AMSS_NCKU_source/bssn_class.C @@ -9402,9 +9402,16 @@ void bssn_class::AH_Step_Find(int lev, double dT_lev) xr[ihn] = yr[ihn] = zr[ihn] = 50; // if(myrank==0) for(ihn=0;ihnlevels; dl++) + bssn_cuda_download_level_state_if_present(GH->PatL[dl], StateList, myrank); + } #endif AHFinderDirect::AHFinderDirect_find_horizons(HN_num, dumpid, - xc, yc, zc, xr, yr, zr, trigger, dTT); + xc, yc, zc, xr, yr, zr, trigger, dTT); // note rhs and Gamijk have been used as temp storage space if (myrank == 0)