File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -56,17 +56,18 @@ def check_nightly_binaries_date(package: str) -> None:
56
56
)
57
57
58
58
def cuda_runtime_error ():
59
+ cuda_exception_missed = True
59
60
try :
60
- torch ._assert_async (torch .tensor (0 , device = 'cuda' ))
61
- torch ._assert_async (torch .tensor (0 + 0j , device = 'cuda' ))
62
- raise RuntimeError ( f"Expected CUDA RuntimeError but have not received anything" )
61
+ torch ._assert_async (torch .tensor (0 , device = "cuda" ))
62
+ torch ._assert_async (torch .tensor (0 + 0j , device = "cuda" ))
63
63
except RuntimeError as e :
64
- if re .search ("CUDA" , f' { e } ' ):
64
+ if re .search ("CUDA" , f" { e } " ):
65
65
print (f"Caught CUDA exception with success: { e } " )
66
+ cuda_exception_missed = False
66
67
else :
67
68
raise (e )
68
- except Exception as e :
69
- raise ( e )
69
+ if ( cuda_exception_missed ) :
70
+ raise RuntimeError ( f"Expected CUDA RuntimeError but have not received!" )
70
71
71
72
def smoke_test_cuda (package : str ) -> None :
72
73
if not torch .cuda .is_available () and is_cuda_system :
You can’t perform that action at this time.
0 commit comments