-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli_entry.py
More file actions
40 lines (31 loc) · 1.81 KB
/
cli_entry.py
File metadata and controls
40 lines (31 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
"""Console entry point for the Buddy CLI."""
from __future__ import annotations
# ═══════════════════════════════════════════════════════════════════════════════
# CRITICAL: macOS OpenMP/MKL/LLVM Conflict Resolution
# ═══════════════════════════════════════════════════════════════════════════════
# MUST be set BEFORE any imports to prevent Segmentation Fault 11 on macOS.
# See main.py for detailed documentation.
# ═══════════════════════════════════════════════════════════════════════════════
import os
import platform
if platform.system() == "Darwin": # macOS
os.environ.setdefault("KMP_DUPLICATE_LIB_OK", "TRUE")
os.environ.setdefault("MKL_THREADING_LAYER", "GNU")
os.environ.setdefault("KMP_AFFINITY", "disabled")
os.environ.setdefault("OMP_NUM_THREADS", "4")
os.environ.setdefault("MKL_NUM_THREADS", "4")
os.environ.setdefault("VECLIB_MAXIMUM_THREADS", "4")
import runpy
import sys
from pathlib import Path
from cli.monitoring_cli import buddy as click_buddy
def main() -> None:
"""Dispatch to the Click monitor command or the legacy CLI."""
if len(sys.argv) > 1 and sys.argv[1] == "monitor":
click_buddy(prog_name="buddy")
return
repo_root = Path(__file__).resolve().parent
script = repo_root / "main.py"
runpy.run_path(str(script), run_name="__main__")
__all__ = ["main"]