diff --git a/src/gausse/gpu/batch_integrator.py b/src/gausse/gpu/batch_integrator.py index 7e60322..fce4051 100644 --- a/src/gausse/gpu/batch_integrator.py +++ b/src/gausse/gpu/batch_integrator.py @@ -139,9 +139,12 @@ def integrate_batch_discharge( energy_diss = xp.zeros(n, dtype=xp.float64) _old_err = xp.seterr(all="ignore") if hasattr(xp, "seterr") else None # стиффные конфиги переполняют fixed-step - for _ in range(max_steps): + # проверку «все ли готовы» делаем НЕ каждый шаг: на GPU это device->host + # синхронизация, которая убивает конвейер. Раз в SYNC_EVERY шагов достаточно. + SYNC_EVERY = 256 + for step in range(max_steps): active = ~done - if not bool(xp.any(active)): + if step % SYNC_EVERY == 0 and not bool(xp.any(active)): break q_old, i_old, x_old, v_old = q, i, x, v