Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cuda_malloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def cuda_malloc_supported():


version = ""
cuda_available = False

try:
torch_spec = importlib.util.find_spec("torch")
Expand All @@ -74,12 +75,13 @@ def cuda_malloc_supported():
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
version = module.__version__
cuda_available = module.cuda != None
except:
pass

if not args.cuda_malloc:
try:
if int(version[0]) >= 2 and "+cu" in version: # enable by default for torch version 2.0 and up only on cuda torch
if int(version[0]) >= 2 and cuda_available: # enable by default for torch version 2.0 and up only on cuda torch
if PerformanceFeature.AutoTune not in args.fast: # Autotune has issues with cuda malloc
args.cuda_malloc = cuda_malloc_supported()
except:
Expand Down