Enable Z4C + Shell-Patch GPU coexistence (Phase 3)

Remove the compile-time #error that blocked USE_CUDA_Z4C + WithShell.
Add GPU-to-CPU state sync at the start of both Z4C Step functions
(non-CPBC and CPBC) so shell CPU consumers read valid field data
after Cartesian GPU RHS with resident state.

Move bssn_cuda_use_resident_sync and bssn_cuda_download_level_state
_if_present from anonymous namespace to file scope in bssn_class.C
so derived classes (Z4C) can call them. Declare both in
bssn_rhs_cuda.h. Include bssn_rhs_cuda.h in Z4c_class.C.

Z4C shell RHS remains on CPU (Fortran Z4c_rhs_ss.f90) pending
future GPU kernel implementation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-10 12:08:02 +08:00
parent 0ca86afd41
commit c4194214c6
3 changed files with 645 additions and 619 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -548,6 +548,8 @@ bool fill_bssn_cuda_views_count(Block *cg, MyList<var> *vars,
return idx == state_count && vars == 0;
}
} // namespace
bool bssn_cuda_use_resident_sync(int lev)
{
(void)lev;
@@ -1032,7 +1034,6 @@ void bssn_cuda_sync_level_bh_fields(MyList<Patch> *PatL,
}
}
} // namespace
#endif
#if !USE_CUDA_BSSN

View File

@@ -404,6 +404,10 @@ void bssn_cuda_release_step_ctx(void *block_tag);
#ifdef __cplusplus
}
// C++-only helpers declared for derived equation classes (Z4C, etc.)
// Defined in bssn_class.C. Requires MyList, Patch, var from including TU.
bool bssn_cuda_use_resident_sync(int lev);
void bssn_cuda_download_level_state_if_present(MyList<Patch> *PatL, MyList<var> *vars, int myrank);
#endif
#endif