Skip to content
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

Mac M1 Support #14697

Closed
deetungsten opened this issue Mar 16, 2021 · 10 comments
Closed

Mac M1 Support #14697

deetungsten opened this issue Mar 16, 2021 · 10 comments
Labels
enhancement Request for new feature and/or capability P1 Issue that should be fixed within a few weeks

Comments

@deetungsten
Copy link

deetungsten commented Mar 16, 2021

Hello,

I am not sure if I should post this on the discuss channel or here but I have been trying to build Ray for the new Mac M1 CPU. Now that bazel, boost, and protobuf is natively supported, it seems possible but I am having issues with the boost bazel rules. I'm having the same exact issue as this ticket but with the M1 CPU. Does anyone have any insight on where to point the srcs and the config settings?

I have done the following:

  1. Manually installed bazel, boost, and protobuf through brew
  2. Applied the hotfix from this ticket to address bazel 4.0.0 issues ([Bazel] Build error from source  #14117)

Thank you!

@deetungsten deetungsten added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Mar 16, 2021
@pierreia
Copy link

pierreia commented Mar 22, 2021

I got exactly the same problem, I spent so many hours configuring my Mac M1 to run machine learning librairies on it... I so regret buying this!!

I installed bazel through Brew and compiled ray from source.

@deetungsten
Copy link
Author

deetungsten commented Mar 25, 2021

@pierreia I hear your frustration but its been kind of fun. I was surprised Ray was still broken even with a Rosetta 2 instance with conda. But I have great news!!! IT COMPILED but it still won't run right. Thanks to nelhage advice, I noticed that the current boost rules should support Mac M1. The version that ray uses is just old so I just commented it out and added this in the bazel setup:

git_repository( name = "com_github_nelhage_rules_boost", commit = "c839cd7130a2aabe1d514805a47f3e7ffa2d9d9e", remote = "https://github.com/nelhage/rules_boost", )
I have a feeling once the 4.0.0 boost fix is merged (held up with some CI stuff I think), everything should build with the Mac M1 by default since the bazel rules should update (in theory).

My next roadblock is that when I import ray, I get this error:

Symbol not found: _aes_hw_cbc_encrypt

@pierreia
Copy link

pierreia commented Apr 3, 2021

Hi, thank you for your answer, did you manage to solve this error?

@deetungsten
Copy link
Author

Unfortunately no, I tried a bunch of things and it did not work. I have a hunch its either gRPC or boringSSL that's breaking something. I'm leaning towards boringSSL and tried to make gRPC build with OpenSSL but my bazel skills is not good enough to make it work.

@deetungsten
Copy link
Author

@pierreia I tried everything with no luck. From building bazel from source (3 and 4) to changing all sorts bazel setup. However, I managed to make it work with Rosetta. I swear I tried this over 10 times a month ago but for some reason it works now. The downside is that you won't get the tensorflow acceleration but it still runs a bit faster than bare intel CPU. I did the following

  1. Open terminal in rosetta mode
  2. Install miniforge x86_64 version
  3. Create conda environment but with python=3.8
  4. Download and install the prebuilt wheels pip3 install ray-2.0.0.dev0-cp38-cp38-macosx_10_13_x86_64.whl
  5. Run python and try to import

I think in terms of native mac M1 ray, I'll have to wait for another couple months until some of the tools that ray uses are native as well.

@deetungsten
Copy link
Author

I'm starting to see the limitation of 8GB RAM. Ray is kinda heavy compared to others (for good reasons) so I clock out at 7.8 GB for a relatively simple model compared to around 6.5 for the same model with stable baseline. I think the shared unified memory makes it hard to run Ray effectively through Rosetta.

@simonfall
Copy link

simonfall commented Jun 20, 2021

I've built and tested the wheels to run Ray natively on M1 Macs, see this release. The versions of boost and grpc had to be updated.

Edit: Updated release.

@iamhatesz
Copy link
Contributor

@simonfall hey, can you share git diff that allows you to build the package?

@simonfall
Copy link

@iamhatesz Sure, just created this PR. Right now, none of Bazel's releases works out-of-the-box for M1 Macs. This should change with release 4.2.0 in the next weeks. The PR should then probably be complemented with some changes to CI/build scripts.

@richardliaw richardliaw added enhancement Request for new feature and/or capability P1 Issue that should be fixed within a few weeks and removed triage Needs triage (eg: priority, bug/not-bug, and owning component) bug Something that is supposed to be working; but isn't labels Jul 7, 2021
@pcmoritz
Copy link
Contributor

This is fixed in #19037 and M1 wheels are released for Ray 1.8.0 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Request for new feature and/or capability P1 Issue that should be fixed within a few weeks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants