perf: cap torch threads per camera worker
Default TORCH_NUM_THREADS=1 so 14-20 workers do not each spawn a 28-thread BLAS pool.
This commit is contained in:
@@ -40,6 +40,7 @@ class Config:
|
||||
enhance_hop_s: float = 0.2
|
||||
# SpeechBrain Delay-and-Sum (GCC-PHAT) on C920 stereo before enhance
|
||||
beamform_mode: str = "auto" # auto | force | off
|
||||
torch_num_threads: int = 1
|
||||
# misc
|
||||
publish_timeout_s: float = 60.0
|
||||
log_level: str = "INFO"
|
||||
@@ -86,6 +87,7 @@ def load_config(env_path: Optional[Path] = None) -> Config:
|
||||
enhance_chunk_s=float(os.environ.get("ENHANCE_CHUNK_S", "1.0")),
|
||||
enhance_hop_s=float(os.environ.get("ENHANCE_HOP_S", "0.2")),
|
||||
beamform_mode=os.environ.get("BEAMFORM_MODE", "auto").lower(),
|
||||
torch_num_threads=int(os.environ.get("TORCH_NUM_THREADS", "1")),
|
||||
publish_timeout_s=float(os.environ.get("PUBLISH_TIMEOUT_S", "60")),
|
||||
log_level=os.environ.get("LOG_LEVEL", "INFO").upper(),
|
||||
cameras=_parse_cameras(os.environ.get("CAMERAS", "all")),
|
||||
@@ -96,4 +98,6 @@ def load_config(env_path: Optional[Path] = None) -> Config:
|
||||
if cfg.beamform_mode not in ("auto", "force", "off"):
|
||||
raise ValueError(
|
||||
f"BEAMFORM_MODE must be auto|force|off, got {cfg.beamform_mode}")
|
||||
if cfg.torch_num_threads < 1:
|
||||
raise ValueError("TORCH_NUM_THREADS must be >= 1")
|
||||
return cfg
|
||||
|
||||
Reference in New Issue
Block a user