-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move MPS device check to cheetah.utils
- Loading branch information
Showing
5 changed files
with
16 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .device import is_mps_available_and_functional # noqa: F401 | ||
from .kde import kde_histogram_1d, kde_histogram_2d # noqa: F401 | ||
from .unique_name_generator import UniqueNameGenerator # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import torch | ||
|
||
|
||
def is_mps_available_and_functional(): | ||
"""Check if MPS is available and functional (for GitHub Actions).""" | ||
if not torch.backends.mps.is_available(): | ||
return False | ||
try: | ||
# Try to allocate a small tensor on the MPS device | ||
torch.tensor([1.0], device="mps") | ||
return True | ||
except RuntimeError: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +0,0 @@ | ||
import torch | ||
|
||
|
||
def is_mps_available_and_functional(): | ||
"""Check if MPS is available and functional (for GitHub Actions).""" | ||
if not torch.backends.mps.is_available(): | ||
return False | ||
try: | ||
# Try to allocate a small tensor on the MPS device | ||
torch.tensor([1.0], device="mps") | ||
return True | ||
except RuntimeError: | ||
return False | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters