Skip to content

Commit

Permalink
Don't change JIT behavior on Neuron.
Browse files Browse the repository at this point in the history
  • Loading branch information
emeryberger committed Dec 23, 2024
1 parent c9b5ac7 commit 8a8c3d9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions scalene/scalene_preload.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,19 @@ def get_preload_environ(args: argparse.Namespace) -> Dict[str, str]:
# PYTORCH_JIT: https://pytorch.org/docs/stable/jit.html#disable-jit-for-debugging
jit_flags = [ ('JAX_DISABLE_JIT', '1'), # truthy => disable JIT
('PYTORCH_JIT', '0') ] # falsy => disable JIT
for name, val in jit_flags:
if name not in os.environ:
env[name] = val

try:
# If we are running on Neuron, we don't disable the JITs
# because it leads to unacceptably high overheads.
from scalene.scalene_neuron import ScaleneNeuron
accelerator = ScaleneNeuron()
on_neuron = accelerator.has_gpu()
except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException' Note

Except block directly handles BaseException.
on_neuron = False
if not on_neuron:
for name, val in jit_flags:
if name not in os.environ:
env[name] = val

# Set environment variables for loading the Scalene dynamic library,
# which interposes on allocation and copying functions.
Expand Down

0 comments on commit 8a8c3d9

Please sign in to comment.