Skip to content

Commit

Permalink
no SIGALRM on windows [pr] (tinygrad#7104)
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot authored Oct 16, 2024
1 parent 9d53429 commit eac58ea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tinygrad/engine/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ class TimeoutException(Exception): pass
def timeout_handler(signum, frame): raise TimeoutException()

def _try_compile_linearized_w_idx(x:Tuple[int,Kernel], compiler:Compiler) -> Tuple[int, Optional[Tuple[Program, bytes, float]]]:
signal.signal(signal.SIGALRM, timeout_handler)
# set timeout
signal.alarm(getenv("BEAM_TIMEOUT_SEC", 10))
if hasattr(signal, "SIGALRM"):
signal.signal(signal.SIGALRM, timeout_handler)
# set timeout
signal.alarm(getenv("BEAM_TIMEOUT_SEC", 10))
try:
p = x[1].to_program(name_override="test")
assert p.uops is not None, "uop list wasn't generated?"
Expand All @@ -75,7 +76,7 @@ def _try_compile_linearized_w_idx(x:Tuple[int,Kernel], compiler:Compiler) -> Tup
if getenv("BEAM_STRICT_MODE"): raise e
ret = None
finally:
signal.alarm(0)
if hasattr(signal, "SIGALRM"): signal.alarm(0)
return x[0], ret

# workers should ignore ctrl c
Expand Down

0 comments on commit eac58ea

Please sign in to comment.