-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Apple silicon GPU(mps) support to ray #38464
Open
NripeshN
wants to merge
22
commits into
ray-project:master
Choose a base branch
from
NripeshN:mps-suspport
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
747f374
Add Apple silicon GPU(mps) support to ray
NripeshN 103bb4e
Merge branch 'master' into mps-suspport
NripeshN fed5704
Merge branch 'master' into mps-suspport
NripeshN ca93927
Merge branch 'master' into mps-suspport
NripeshN c1278c2
Merge branch 'master' into mps-suspport
NripeshN 18a7d17
Merge branch 'master' into mps-suspport
NripeshN 68a615b
Merge branch 'master' into mps-suspport
NripeshN 79f5a20
Merge branch 'master' into mps-suspport
NripeshN a90e46b
Merge branch 'master' into mps-suspport
NripeshN 1accb25
Merge branch 'master' into mps-suspport
NripeshN 6a78649
Merge branch 'master' into mps-suspport
NripeshN 582c846
Merge branch 'master' into mps-suspport
NripeshN e5d061e
Merge branch 'master' into mps-suspport
NripeshN 62fb589
Merge branch 'master' into mps-suspport
NripeshN f27e77e
add apple gpu
NripeshN 1a0086a
Merge branch 'master' into mps-suspport
NripeshN ae30449
remove torch utils
NripeshN 270acae
Merge branch 'master' into mps-suspport
NripeshN 9ed3294
Merge branch 'master' into mps-suspport
NripeshN 2640651
Merge branch 'master' into mps-suspport
NripeshN def0b91
Merge branch 'master' into mps-suspport
NripeshN fa1dda2
Merge branch 'master' into mps-suspport
NripeshN File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,51 @@ | ||
import os | ||
import logging | ||
from typing import Optional, List, Tuple | ||
|
||
from ray._private.accelerators.accelerator import AcceleratorManager | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
class AppleGPUAcceleratorManager(AcceleratorManager): | ||
"""Apple GPU accelerators manager.""" | ||
|
||
@staticmethod | ||
def get_resource_name() -> str: | ||
return "GPU" | ||
|
||
@staticmethod | ||
def get_visible_accelerator_ids_env_var() -> str: | ||
# There isn't a direct equivalent to CUDA_VISIBLE_DEVICES for Apple Silicon GPUs. | ||
# However, the USE_MPS environment variable can be used for enabling MPS support in PyTorch. | ||
return "USE_MPS" | ||
|
||
@staticmethod | ||
def get_current_node_num_accelerators() -> int: | ||
return 1 | ||
|
||
@staticmethod | ||
def get_current_node_accelerator_type() -> Optional[str]: | ||
return "Apple GPU" # Generic name, as there isn't a specific model like Nvidia's H100 | ||
|
||
@staticmethod | ||
def validate_resource_request_quantity(quantity: float) -> Tuple[bool, Optional[str]]: | ||
if quantity >= 0: | ||
return True, None | ||
else: | ||
return False, "Quantity cannot be negative." | ||
|
||
@staticmethod | ||
def get_current_process_visible_accelerator_ids() -> Optional[List[str]]: | ||
return None | ||
|
||
@staticmethod | ||
def set_current_process_visible_accelerator_ids(ids: List[str]) -> None: | ||
pass | ||
|
||
@staticmethod | ||
def get_ec2_instance_num_accelerators(instance_type: str, instances: dict) -> Optional[int]: | ||
return None | ||
|
||
@staticmethod | ||
def get_ec2_instance_accelerator_type(instance_type: str, instances: dict) -> Optional[str]: | ||
return None |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the currently node doesn't have apple accelerators, we shouldn't return 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey,
quick question. All Apple silicon laptops have mps accelerator support.
So shouldn't it always be 1?