mytec: after methods

This commit is contained in:
2026-02-02 01:55:09 +02:00
parent b5b2fd90d2
commit aa07fb5f02
10 changed files with 495 additions and 101 deletions

View File

@@ -21,6 +21,7 @@ Usage:
)
"""
import gc
import os
import sys
import subprocess
@@ -450,6 +451,9 @@ def _calculate_with_ray(
log_fn(f"Ray done: {calc_time:.1f}s, {len(all_results)} results "
f"({calc_time / max(1, total_points) * 1000:.1f}ms/point)")
# Force garbage collection after Ray computation
gc.collect()
timing = {
"parallel_total": calc_time,
"ray_put": put_time,
@@ -744,6 +748,8 @@ def _calculate_with_process_pool(
block.unlink()
except Exception:
pass
# Force garbage collection to release memory from workers
gc.collect()
calc_time = time.time() - t_calc
log_fn(f"ProcessPool done: {calc_time:.1f}s, {len(all_results)} results "
@@ -820,6 +826,9 @@ def _calculate_sequential(
log_fn(f"Sequential done: {calc_time:.1f}s, {len(results)} results "
f"({calc_time / max(1, total) * 1000:.1f}ms/point)")
# Force garbage collection after sequential computation
gc.collect()
timing["sequential_total"] = calc_time
timing["backend"] = "sequential"
return results, timing