Skip to content

Instantly share code, notes, and snippets.

@imfing
Created October 22, 2022 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imfing/832d803ca655bd7ab1e2a634392419f6 to your computer and use it in GitHub Desktop.
Save imfing/832d803ca655bd7ab1e2a634392419f6 to your computer and use it in GitHub Desktop.
Build Ray Python wheel for Linux aarch64

Building Ray Python Wheel for aarch64

I used a EC2 A1 instance (a1.2xlarge) with Ubuntu 20.04 (arm64)

$ lscpu
Architecture:                    aarch64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
CPU(s):                          8

Install packages

$ sudo apt install python3-pip python-dev build-essential curl unzip wget pkg-config -y 

Install Bazel

$ bazel_version=5.3.1
$ wget https://github.com/bazelbuild/bazel/releases/download/${bazel_version}/bazel-${bazel_version}-linux-arm64
$ mkdir -p ~/.bazel/bin && mv bazel-5.3.1-linux-arm64 ~/.bazel/bin/bazel && chmod +x ~/.bazel/bin/bazel
$ sudo ln -s ~/.bazel/bin/bazel /usr/local/bin/bazel

Enable fastbuild by adding this to ~/.bazelrc:

build --compilation_mode=fastbuild

Otherwise, the build process will spend long time optimizing the build.

Build Ray Python Wheel

Clone ray

$ git clone --branch ray-2.0.0 --depth 1 https://github.com/ray-project/ray.git

Build wheel

$ cd ray/python
$ python3 setup.py bdist_wheel

We may also want to disable build_cpp in setup.py to reduce the build time.

The built wheel will be under dist directory:

~/ray/python$ ls dist
ray-2.0.0-cp38-cp38-linux_aarch64.whl

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment