[docs/usability] Apple Silicon support (#19705)

This PR puts the final touches on apple silicon support. There are 3 main caveats to supporting M1 macs right now (described in the docs):

Requires using forge.
Requires special installation instructions to get grpc working (this is an underlying grpc issue, so ideally it will be fixed upstream).
We're only publishing release wheels, not nightlies right now.
This also includes a grpc import check to ensure that we provide an actionable error message if the user tries the regular pip install ray process to properly install grpcio.
This commit is contained in:
Alex Wu 2021-10-25 14:49:28 -07:00 committed by GitHub
parent e3ced0e59e
commit 58b28f04cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View file

@ -154,6 +154,21 @@ The latest Ray Java snapshot can be found in `sonatype repository <https://oss.s
If you want to run your Java code in a multi-node Ray cluster, it's better to exclude Ray jars when packaging your code to avoid jar conficts if the versions (installed Ray with ``pip install`` and maven dependencies) don't match.
.. _apple-silcon-supprt:
Apple Silicon Support
---------------------
Ray has experimental support for machines running Apple Silicon (such as M1 macs). To get started:
1. Install `miniforge <https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh>`_.
2. Ensure that the ``grpcio`` package is installed via forge and **not pypi**: ``pip uninstall grpcio; conda install grpcio``.
3. Install Ray as you normally would: ``pip install ray``.
.. note::
At this time, Apple Silicon ray wheels are being published for **releass only**. As support stabilizes, nightly wheels will be published in the future.
.. _windows-support:
Windows Support

View file

@ -1,5 +1,5 @@
import os
import logging
import os
logger = logging.getLogger(__name__)
@ -28,6 +28,20 @@ def _configure_system():
"make sure you are using pickle5 >= 0.0.10 because "
"previous versions may leak memory.")
# Check that grpc can actually be imported on Apple Silicon. Some package
# managers (such as `pip`) can't properly install the grpcio library yet,
# so provide a proactive error message if that's the case.
if platform.system() == "Darwin" and platform.machine() == "arm64":
try:
import grpc # noqa: F401
except ImportError:
raise ImportError(
"Failed to import grpc on Apple Silicon. On Apple"
" Silicon machines, try `pip uninstall grpcio; conda "
"install grpcio`. Check out "
"https://docs.ray.io/en/master/installation.html"
"#apple-silicon-support for more details.")
if "OMP_NUM_THREADS" not in os.environ:
logger.debug("[ray] Forcing OMP_NUM_THREADS=1 to avoid performance "
"degradation with many workers (issue #6998). You can "