Add zero matter handling and interpolation for resident state in CUDA BSSN
This commit is contained in:
@@ -4665,6 +4665,13 @@ static void upload_matter_cache(StepContext &ctx,
|
||||
ctx.matter_ready = true;
|
||||
}
|
||||
|
||||
static void zero_matter_cache(StepContext &ctx, size_t all)
|
||||
{
|
||||
CUDA_CHECK(cudaMemset(ctx.d_matter_mem, 0,
|
||||
(size_t)BSSN_MATTER_COUNT * all * sizeof(double)));
|
||||
ctx.matter_ready = true;
|
||||
}
|
||||
|
||||
static void bind_matter_slots(const StepContext &ctx)
|
||||
{
|
||||
for (int i = 0; i < BSSN_MATTER_COUNT; ++i) {
|
||||
@@ -5630,6 +5637,7 @@ int bssn_cuda_rk4_substep(void *block_tag,
|
||||
int &Lev,
|
||||
double &eps,
|
||||
int &co,
|
||||
int &use_zero_matter,
|
||||
int &keep_resident_state,
|
||||
int &apply_enforce_ga,
|
||||
double &chitiny)
|
||||
@@ -5686,12 +5694,17 @@ int bssn_cuda_rk4_substep(void *block_tag,
|
||||
|
||||
t0 = profile ? cuda_profile_now_ms() : 0.0;
|
||||
if (RK4 == 0) {
|
||||
upload_matter_cache(ctx, matter_host, all);
|
||||
if (use_zero_matter) {
|
||||
if (!ctx.matter_ready) zero_matter_cache(ctx, all);
|
||||
} else {
|
||||
upload_matter_cache(ctx, matter_host, all);
|
||||
}
|
||||
CUDA_CHECK(cudaMemcpy(ctx.d_state0_mem, g_buf.slot[S_chi],
|
||||
(size_t)BSSN_STATE_COUNT * bytes,
|
||||
cudaMemcpyDeviceToDevice));
|
||||
} else if (!ctx.matter_ready) {
|
||||
upload_matter_cache(ctx, matter_host, all);
|
||||
if (use_zero_matter) zero_matter_cache(ctx, all);
|
||||
else upload_matter_cache(ctx, matter_host, all);
|
||||
}
|
||||
bind_matter_slots(ctx);
|
||||
if (profile) {
|
||||
|
||||
Reference in New Issue
Block a user