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

ARM builder image #373

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions .devcontainer/devcontainer.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
strategy:
fail-fast: false
matrix:
runs-on: ["ubuntu-latest"]
runs-on: ["ubuntu-22.04"]
otp: ["24.2", "25.0"]
elixir: ["1.13.0", "1.16.2", "1.17.2"]
exclude:
- otp: "24.2"
elixir: "1.17.2"
include:
- runs-on: "ubuntu-latest"
- runs-on: "ubuntu-22.04"
otp: "27.0.1"
elixir: "1.17.2"
steps:
Expand All @@ -67,7 +67,7 @@ jobs:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Set up Zig
uses: goto-bus-stop/setup-zig@v2
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- uses: Jimver/cuda-toolkit@master
Expand Down
62 changes: 61 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- release*
tags:
- "*"
pull_request:
Expand Down Expand Up @@ -65,7 +66,7 @@ jobs:
otp-version: ${{ matrix.job.otp }} # Define the OTP version [required]
- run: elixir --eval ":erlang.system_info(:nif_version) |> IO.puts"
- name: Set up Zig
uses: goto-bus-stop/setup-zig@v2
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- uses: Jimver/cuda-toolkit@master
Expand Down Expand Up @@ -131,3 +132,62 @@ jobs:
BEAVER_ARTEFACT_URL: "https://github.com/beaver-lodge/beaver-prebuilt/releases/download/${{ needs.generate_id.outputs.formatted_date }}/@{artefact_filename}"
run: |
mix run bench/enif_add_benchmark.exs

arm_docker:
needs: [generate_id]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- {
platform: "linux/arm64/v8",
suffix: "arm64",
zig: "https://ziglang.org/download/0.13.0/zig-linux-aarch64-0.13.0.tar.xz"
}
- {
platform: "linux/amd64",
suffix: "amd64",
zig: "https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz"
}
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: ${{ matrix.image.platform != 'linux/amd64' }}
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ secrets.DOCKERHUB_USERNAME != '' }}
tags: jackalcooper/beaver-livebook-${{ matrix.image.suffix }}:latest
cache-from: type=registry,ref=jackalcooper/beaver-livebook-${{ matrix.image.suffix }}:latest
cache-to: type=inline
platforms: |
${{ matrix.image.platform }}
file: docker/livebook.dockerfile
target: base
build-args: |
ZIG_URL=${{ matrix.image.zig }}
- uses: actions/checkout@v3
name: Check-out beaver
with:
repository: beaver-lodge/beaver
path: beaver
- uses: actions/checkout@v3
name: Check-out kinda
with:
repository: beaver-lodge/kinda
path: kinda
jackalcooper marked this conversation as resolved.
Show resolved Hide resolved
- name: Build ARM
continue-on-error: true
if: ${{ matrix.image.platform == 'linux/arm64/v8' }}
run: docker run --platform ${{ matrix.image.platform }} -v $PWD:/src -w /src/beaver jackalcooper/beaver-livebook-${{ matrix.image.suffix }}:latest bash scripts/build-for-publish.sh
jackalcooper marked this conversation as resolved.
Show resolved Hide resolved
- name: Build x86
if: ${{ matrix.image.platform == 'linux/amd64' }}
run: docker run -v $PWD:/src -w /src/beaver jackalcooper/beaver-livebook-${{ matrix.image.suffix }}:latest bash scripts/build-for-publish.sh
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ Bindings are the part that provides the interface to the MLIR CAPIs. It is imple

- Run CI, which generates the new GitHub release uploaded to https://github.com/beaver-lodge/beaver-prebuilt/releases.
- Update release url in [`mix.exs`](/mix.exs)
- Run docker image to build for ARM:
```bash
docker run -it --rm -v $PWD/..:/src -w /src/beaver --env MIX_BUILD_ROOT='_build/arm' jackalcooper/beaver-livebook-arm64:latest bash scripts/build-for-publish.sh
```

### Mac

Expand Down
4 changes: 2 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mlir==20.0.0.2024112701+fad5ed6e; sys_platform != "linux"
mlir==20.0.0.2024112701+cuda.fad5ed6e; sys_platform == "linux"
mlir==20.0.0.2024120301+cuda.814ed93e; sys_platform == "linux" and platform_machine == "x86_64"
mlir==20.0.0.2024120301+814ed93e; sys_platform != "linux" or platform_machine != "x86_64"
--find-links https://github.com/makslevental/mlir-wheels/releases/expanded_assets/latest
jackalcooper marked this conversation as resolved.
Show resolved Hide resolved
31 changes: 31 additions & 0 deletions docker/livebook.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM ghcr.io/livebook-dev/livebook:0.14.5 AS base
RUN apt-get upgrade -y \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
ninja-build \
python3-pip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# LLVM
COPY ./dev-requirements.txt /src/dev-requirements.txt
RUN python3 -m pip install -r /src/dev-requirements.txt && python3 -m pip cache purge
RUN ln -s $(python3 -c 'import mlir;print(mlir.__path__[0])') /usr/local/mlir
ENV PATH=/usr/local/mlir/bin:${PATH}
RUN llvm-config --version
# Zig
ARG ZIG_URL="https://ziglang.org/download/0.13.0/zig-linux-aarch64-0.13.0.tar.xz"
RUN wget "${ZIG_URL}" -O "zig-linux.tar.xz" \
&& tar Jxvf "zig-linux.tar.xz" -C /usr/local \
&& mv /usr/local/zig-linux-*-* /usr/local/zig-linux \
&& rm "zig-linux.tar.xz"
jackalcooper marked this conversation as resolved.
Show resolved Hide resolved
ENV PATH=/usr/local/zig-linux:${PATH}
RUN zig version
ENV ERL_FLAGS="+JMsingle true"

FROM base AS build
COPY . /src
WORKDIR /src
ENV MIX_ENV=prod
ENV ELIXIR_MAKE_CACHE_DIR=.
RUN mix deps.get
RUN mix elixir_make.precompile
jackalcooper marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Beaver.MixProject do
def project do
[
app: :beaver,
version: "0.3.11-dev",
version: "0.4.0",
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
Expand All @@ -19,7 +19,7 @@ defmodule Beaver.MixProject do
make_force_build: System.get_env("BEAVER_BUILD_CMAKE") in ["1", "true"],
make_precompiler_url:
System.get_env("BEAVER_ARTEFACT_URL") ||
"https://github.com/beaver-lodge/beaver-prebuilt/releases/download/2024-09-03-0613/@{artefact_filename}",
"https://github.com/beaver-lodge/beaver-prebuilt/releases/download/2024-12-04-0908/@{artefact_filename}",
make_precompiler_nif_versions: [
versions: fn opts ->
target = opts.target
Expand Down Expand Up @@ -115,7 +115,7 @@ defmodule Beaver.MixProject do
defp deps do
[
{:elixir_make, "~> 0.4", runtime: false},
{:kinda, "~> 0.9.2"},
{:kinda, "~> 0.9.3"},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:benchee, "~> 1.0", only: :dev},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false}
Expand Down
12 changes: 6 additions & 6 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
%{
"benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"credo": {:hex, :credo, "1.7.8", "9722ba1681e973025908d542ec3d95db5f9c549251ba5b028e251ad8c24ab8c5", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "cb9e87cc64f152f3ed1c6e325e7b894dea8f5ef2e41123bd864e3cd5ceb44968"},
"credo": {:hex, :credo, "1.7.10", "6e64fe59be8da5e30a1b96273b247b5cf1cc9e336b5fd66302a64b25749ad44d", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "71fbc9a6b8be21d993deca85bf151df023a3097b01e09a2809d460348561d8cd"},
"deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
"earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"},
"elixir_make": {:hex, :elixir_make, "0.8.4", "4960a03ce79081dee8fe119d80ad372c4e7badb84c493cc75983f9d3bc8bde0f", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "6e7f1d619b5f61dfabd0a20aa268e575572b542ac31723293a4c1a567d5ef040"},
"ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"},
"elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"},
"ex_doc": {:hex, :ex_doc, "0.35.1", "de804c590d3df2d9d5b8aec77d758b00c814b356119b3d4455e4b8a8687aecaf", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "2121c6402c8d44b05622677b761371a759143b958c6c19f6558ff64d0aed40df"},
"file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
"kinda": {:hex, :kinda, "0.9.2", "d75aaac76810f50b9db91347034f73e4a305a9a6ba405862f4db7342793e265b", [:mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "fd4a8484cd95d6e17de841079466e70ff8d96fe996fbd44bb3d7a6be95ce30ac"},
"makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
"kinda": {:hex, :kinda, "0.9.3", "936e1e7a6e54943b078366319af4de4cce5f2ff2a9462e03187fcf762278f93c", [:mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "6661b01420625474ebe1cbb592e8ea450d6434943c6c04800183ccee62fbfbd7"},
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
"makeup_elixir": {:hex, :makeup_elixir, "1.0.0", "74bb8348c9b3a51d5c589bf5aebb0466a84b33274150e3b6ece1da45584afc82", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "49159b7d7d999e836bedaf09dcf35ca18b312230cf901b725a64f3f42e407983"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
"statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"},
Expand Down
2 changes: 1 addition & 1 deletion native/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LLVM_CONFIG_PATH ?= $($(shell echo $$LLVM_CONFIG_PATH), llvm-config)
LLVM_CONFIG_PATH ?= llvm-config
LLVM_LIB_DIR := $(shell ${LLVM_CONFIG_PATH} --libdir)
LLVM_CMAKE_DIR = $(LLVM_LIB_DIR)/cmake/llvm
MLIR_CMAKE_DIR = $(LLVM_LIB_DIR)/cmake/mlir
Expand Down
1 change: 1 addition & 0 deletions scripts/build-for-publish.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set -e
export MIX_ENV=prod
export ELIXIR_MAKE_CACHE_DIR=.
mix deps.get
mix elixir_make.precompile
Loading