Skip to content

Commit 61281ad

Browse files
authored
Fix build deps (#116)
* Fix build deps * ixup * More fixes * pypi jax * fixup * Cleanup * Fix case insensitive file system * Fixup deps * fix hashes * Fix openstack * fix * More cleanup * Cleanup * GPU results * fixes * fix * Update llama.py * fix * Fix * fix * Update pipeline.yml * Update gpu_pipeline.yml * Update gpu_pipeline.yml * Update pipeline.yml
1 parent 928b66f commit 61281ad

26 files changed

+1634
-752
lines changed

.buildkite/gpu_pipeline.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,15 @@ steps:
1616
1717
mv bazel* .local/bin/bazel
1818
chmod +x .local/bin/bazel
19-
wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-Linux-x86_64.sh
20-
chmod +x Miniconda*.sh
21-
./Miniconda*.sh -b -p `pwd`/conda
22-
rm Miniconda*.sh
2319
24-
python -m ensurepip --upgrade
25-
python -m pip install --user numpy wheel
2620
mkdir -p .baztmp
27-
rm -f bazel-bin/*.whl
28-
HERMETIC_PYTHON_VERSION=`python -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))"` bazel --output_user_root=`pwd`/.baztmp build --python_path=`which python` --define=no_nccl_support=true :enzyme_ad
29-
cp bazel-bin/*.whl .
30-
python -m pip install --user *.whl "jax[cuda12]"
3121
3222
echo "--- :python: Test"
3323
34-
HERMETIC_PYTHON_VERSION=`python -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))"` bazel --output_user_root=`pwd`/.baztmp test --python_path=`which python` --test_output=errors //test/...
24+
HERMETIC_PYTHON_VERSION="3.12" bazel --output_user_root=`pwd`/.baztmp test --test_output=errors //test/...
25+
HERMETIC_PYTHON_VERSION="3.12" bazel --output_user_root=`pwd`/.baztmp test --cache_test_results=no //test:bench_vs_xla
26+
HERMETIC_PYTHON_VERSION="3.12" bazel --output_user_root=`pwd`/.baztmp test --cache_test_results=no //test:llama
27+
cat bazel-out/*/testlogs/test/llama/test.log
28+
artifact_paths:
29+
- "bazel-out/*/testlogs/test/llama/test.log"
30+
- "bazel-out/*/testlogs/test/llama/bench_vs_xla.log"

.buildkite/pipeline.yml

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
steps:
2-
- name: "CI {{matrix.arch}} -- {{matrix.os}}"
2+
- name: "CI {{matrix.arch}} -- {{matrix.os}} python {{matrix.python}}"
33
matrix:
44
setup:
55
arch:
66
- aarch64
77
- x86_64
88
os:
99
- macos
10+
python:
11+
- "3.12"
1012
agents:
1113
queue: "juliaecosystem"
1214
os: "{{matrix.os}}"
@@ -30,52 +32,31 @@ steps:
3032
chmod +x .local/bin/md5
3133
3234
if [ "{{matrix.os}}" == "macos" ]; then
33-
if [ "{{matrix.arch}}" == "aarch64" ]; then
34-
sed -i.bak 's~targets = \[.*\]~targets = \[\"AArch64\", \"AMDGPU\"]~g' WORKSPACE
35-
curl -fLO https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-MacOSX-arm64.sh
36-
else
37-
sed -i.bak 's~targets = \[.*\]~targets = \[\"X86\", \"AMDGPU\"]~g' WORKSPACE
38-
curl -fLO https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-MacOSX-{{matrix.arch}}.sh
39-
fi
4035
curl -fLO "https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-darwin"
4136
mv bazelisk-darwin .local/bin/bazel
4237
chmod +x .local/bin/bazel
43-
chmod +x Miniconda*.sh
44-
./Miniconda*.sh -b -p `pwd`/conda
45-
rm Miniconda*.sh
4638
elif [ "{{matrix.os}}" == "linux" ]; then
47-
if [ "{{matrix.arch}}" == "aarch64" ]; then
48-
curl -fLO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-arm64
49-
else
50-
curl -fLO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-amd64
51-
fi
5239
mv bazel* .local/bin/bazel
5340
chmod +x .local/bin/bazel
54-
wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-Linux-{{matrix.arch}}.sh
55-
chmod +x Miniconda*.sh
56-
./Miniconda*.sh -b -p `pwd`/conda
57-
rm Miniconda*.sh
5841
else
59-
wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-Windows-{{matrix.arch}}.exe
6042
if [ "{{matrix.arch}}" == "aarch64" ]; then
6143
wget https://github.com/bazelbuild/bazel/releases/download/6.2.1/bazel-6.2.1-windows-arm64.exe
6244
else
6345
wget https://github.com/bazelbuild/bazel/releases/download/6.2.1/bazel-6.2.1-windows-x86_64.exe
6446
fi
6547
mv bazel* .local/bin/bazel.exe
66-
start /wait "" Miniconda3*.exe /InstallationType=JustMe /RegisterPython=0 /S /D=`pwd`/conda
67-
rm Miniconda*.exe
6848
fi
69-
# conda install -c conda-forge cxx-compiler -y
70-
python -m ensurepip --upgrade
71-
python -m pip install --user numpy wheel
7249
mkdir -p .baztmp
50+
HERMETIC_PYTHON_VERSION={{matrix.python}} bazel --output_user_root=`pwd`/.baztmp test --test_output=errors //test/...
51+
HERMETIC_PYTHON_VERSION={{matrix.python}} bazel --output_user_root=`pwd`/.baztmp test --cache_test_results=no //test:bench_vs_xla
52+
HERMETIC_PYTHON_VERSION={{matrix.python}} bazel --output_user_root=`pwd`/.baztmp test --cache_test_results=no //test:llama
53+
cat bazel-out/*/testlogs/test/llama/test.log
7354
rm -f bazel-bin/*.whl
74-
HERMETIC_PYTHON_VERSION=`python -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))"` bazel --output_user_root=`pwd`/.baztmp build --python_path=`which python` --define=no_nccl_support=true :enzyme_ad
55+
HERMETIC_PYTHON_VERSION={{matrix.python}} bazel --output_user_root=`pwd`/.baztmp build :wheel
7556
cp bazel-bin/*.whl .
76-
python -m pip install --user *.whl "jax[cpu]"
77-
HERMETIC_PYTHON_VERSION=`python -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))"` bazel --output_user_root=`pwd`/.baztmp test --python_path=`which python` --test_output=errors //test/...
7857
artifact_paths:
7958
- "*.whl"
59+
- "bazel-out/*/testlogs/test/llama/test.log"
60+
- "bazel-out/*/testlogs/test/llama/bench_vs_xla.log"
8061

8162
timeout_in_minutes: 180

.buildkite/secure_pipeline.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
steps:
2-
- name: "Tag {{matrix.arch}} -- {{matrix.os}}"
2+
- name: "Tag {{matrix.arch}} -- {{matrix.os}} python {{matrix.python}}"
33
matrix:
44
setup:
55
arch:
@@ -30,19 +30,9 @@ steps:
3030
chmod +x .local/bin/md5
3131
3232
if [ "{{matrix.os}}" == "macos" ]; then
33-
if [ "{{matrix.arch}}" == "aarch64" ]; then
34-
sed -i.bak 's~targets = \[.*\]~targets = \[\"AArch64\", \"AMDGPU\"]~g' WORKSPACE
35-
curl -fLO https://repo.anaconda.com/miniconda/Miniconda3-py3`echo {{matrix.python}} | cut -c 3-`_24.7.1-0-MacOSX-arm64.sh
36-
else
37-
sed -i.bak 's~targets = \[.*\]~targets = \[\"X86\", \"AMDGPU\"]~g' WORKSPACE
38-
curl -fLO https://repo.anaconda.com/miniconda/Miniconda3-py3`echo {{matrix.python}} | cut -c 3-`_24.7.1-0-MacOSX-{{matrix.arch}}.sh
39-
fi
4033
curl -fLO "https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-darwin"
4134
mv bazelisk-darwin .local/bin/bazel
4235
chmod +x .local/bin/bazel
43-
chmod +x Miniconda*.sh
44-
./Miniconda*.sh -b -p `pwd`/conda
45-
rm Miniconda*.sh
4636
elif [ "{{matrix.os}}" == "linux" ]; then
4737
if [ "{{matrix.arch}}" == "aarch64" ]; then
4838
curl -fLO https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-arm64
@@ -51,25 +41,20 @@ steps:
5141
fi
5242
mv bazel* .local/bin/bazel
5343
chmod +x .local/bin/bazel
54-
wget https://repo.anaconda.com/miniconda/Miniconda3-py3`echo {{matrix.python}} | cut -c 3-`_24.7.1-0-Linux-{{matrix.arch}}.sh
55-
chmod +x Miniconda*.sh
56-
./Miniconda*.sh -b -p `pwd`/conda
57-
rm Miniconda*.sh
5844
else
59-
wget https://repo.anaconda.com/miniconda/Miniconda3-py3`echo {{matrix.python}} | cut -c 3-`_24.7.1-0-Windows-{{matrix.arch}}.exe
6045
if [ "{{matrix.arch}}" == "aarch64" ]; then
6146
wget https://github.com/bazelbuild/bazel/releases/download/6.2.1/bazel-6.2.1-windows-arm64.exe
6247
else
6348
wget https://github.com/bazelbuild/bazel/releases/download/6.2.1/bazel-6.2.1-windows-x86_64.exe
6449
fi
6550
mv bazel* .local/bin/bazel.exe
6651
fi
67-
python -m ensurepip --upgrade
68-
python -m pip install --user numpy wheel
6952
mkdir baztmp
7053
export TAG=`echo $BUILDKITE_TAG | cut -c2-`
7154
sed -i.bak "s~version = \"[0-9.]*\"~version = \"\$TAG\"~g" BUILD
72-
HERMETIC_PYTHON_VERSION={{matrix.python}} bazel --output_user_root=`pwd`/baztmp build --define=no_nccl_support=true :enzyme_ad
55+
HERMETIC_PYTHON_VERSION={{matrix.python}} bazel --output_user_root=`pwd`/baztmp build @llvm-project//llvm:FileCheck
56+
rm bazel-bin/*.whl
57+
HERMETIC_PYTHON_VERSION={{matrix.python}} bazel --output_user_root=`pwd`/baztmp build :wheel
7358
cp bazel-bin/*.whl .
7459
python -m pip install *.whl
7560
python -m pip install --user twine
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Salted__Q� "���=x��:�W�ԇ.�<+���9� E�g�h�d;�h?}��e�^Vr�?n�T�Wdˤ��N�.T�A��Y=q#V:��M7�
1+
Salted__�F� �܌ɈLY�o�j�vQ��Z��4�*w��5�5W��y#����WY΀ۇ��Ѝ�86��9����Ř;��I�Q�]PvkU'�b�IJ

.github/workflows/build.yml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ on:
99

1010
jobs:
1111
build:
12-
name: Build ${{ matrix.os }}
12+
name: Build ${{ matrix.os }} python ${{ matrix.python }}
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
fail-fast: false
1616
matrix:
1717
os: [openstack22]
18+
python: ["3.12"]
1819
timeout-minutes: 500
1920
steps:
2021
- name: add llvm
2122
run: |
2223
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
2324
sudo apt-get update
24-
sudo apt-get install -y git gcc g++ python3 python3-dev python3-pip
25-
sudo python3 -m pip install --upgrade lit
25+
sudo apt-get install -y git gcc g++ #python3 python3-dev python3-pip
26+
#sudo python3 -m pip install --upgrade lit
27+
#- run: python3 -m pip install --user numpy
2628
fi
27-
- run: python3 -m pip install --user numpy
2829
- uses: actions/checkout@v3
2930
with:
3031
submodules: recursive
@@ -42,20 +43,15 @@ jobs:
4243
repository-cache: true
4344
bazelisk-version: 1.x
4445

45-
- run: |
46-
HERMETIC_PYTHON_VERSION=`python3 -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))"` bazel build @llvm-project//llvm:FileCheck
47-
sudo rm bazel-bin/*.whl || echo
48-
HERMETIC_PYTHON_VERSION=`python3 -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))"` bazel build :enzyme_ad
49-
50-
- run: cp bazel-bin/*.whl .
51-
5246
- name: test
5347
run: |
54-
ls -all .
55-
ls -all bazel-bin
56-
python3 -m pip uninstall enzyme-ad -y || echo
57-
python3 -m pip install --user --force-reinstall "jax[cpu]" *.whl
58-
HERMETIC_PYTHON_VERSION=`python3 -c "import sys; print('{0[0]}.{0[1]}'.format(sys.version_info))"` bazel test --test_output=errors ...
48+
HERMETIC_PYTHON_VERSION=${{ matrix.python }} bazel test --test_output=errors ...
49+
50+
- name: Build Wheel
51+
run: |
52+
sudo rm bazel-bin/*.whl || echo
53+
HERMETIC_PYTHON_VERSION=${{ matrix.python }} bazel build :wheel
54+
cp bazel-bin/*.whl .
5955
6056
- name: Upload Build
6157
uses: actions/upload-artifact@v3

.github/workflows/tag.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
build:
9-
name: Build ${{ matrix.os }} python ${{ matrix.python }}
9+
name: Tag ${{ matrix.os }} python ${{ matrix.python }}
1010
runs-on: ${{ matrix.os }}
1111
strategy:
1212
fail-fast: false
@@ -45,7 +45,7 @@ jobs:
4545
- run: |
4646
HERMETIC_PYTHON_VERSION=${{ matrix.python }} bazel build @llvm-project//llvm:FileCheck
4747
sudo rm bazel-bin/*.whl || echo
48-
HERMETIC_PYTHON_VERSION=${{ matrix.python }} bazel build :enzyme_ad
48+
HERMETIC_PYTHON_VERSION=${{ matrix.python }} bazel build :wheel
4949
- env:
5050
TWINE_USERNAME: __token__
5151
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

BUILD

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,22 @@ cc_binary(
6666
],
6767
)
6868

69-
py_wheel(
69+
py_library(
7070
name = "enzyme_ad",
71+
visibility = ["//visibility:public"],
72+
deps = [
73+
"@pypi_jax//:pkg",
74+
"@pypi_absl_py//:pkg",
75+
],
76+
imports=["src"],
77+
data = [
78+
"//:enzyme_jax_data",
79+
"//src/enzyme_ad/jax:enzyme_jax_internal",
80+
]
81+
)
82+
83+
py_wheel(
84+
name = "wheel",
7185
author = "Enzyme Authors",
7286
author_email = "wmoses@mit.edu, zinenko@google.com",
7387
distribution = "enzyme_ad",

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ pip install enzyme-ad
4444

4545
## Building from source
4646

47-
Requirements: `bazel-6.2.1`, `clang++`, `python`, `python-virtualenv`,
47+
Requirements: `bazel-6.5`, `clang++`, `python`, `python-virtualenv`,
4848
`python3-dev`.
4949

5050
Build our extension with:
5151
```sh
5252
# Will create a whl in bazel-bin/enzyme_ad-VERSION-SYSTEM.whl
53-
bazel build :enzyme_ad
53+
bazel build :wheel
5454
```
5555

5656
Finally, install the built library with:
@@ -61,6 +61,12 @@ Note that you cannot run code from the root of the git directory. For instance,
6161

6262
## Running the test
6363

64+
To run tests, you can simply execute the following bazel commands (this does not require building or installing the wheel).
65+
```sh
66+
bazel test //test/...
67+
```
68+
69+
Alternatively, if you have installed the wheel, you can manually invoke the tests as follows
6470
```sh
6571
cd test && python test.py
6672
```

WORKSPACE

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ python_init_rules()
4141
load("@xla//third_party/py:python_init_repositories.bzl", "python_init_repositories")
4242
python_init_repositories(
4343
requirements = {
44-
"3.9": "//build:requirements_lock_3_9.txt",
45-
"3.10": "//build:requirements_lock_3_10.txt",
46-
"3.11": "//build:requirements_lock_3_11.txt",
47-
"3.12": "//build:requirements_lock_3_12.txt",
48-
"3.13": "//build:requirements_lock_3_13.txt",
44+
"3.10": "//builddeps:requirements_lock_3_10.txt",
45+
"3.11": "//builddeps:requirements_lock_3_11.txt",
46+
"3.12": "//builddeps:requirements_lock_3_12.txt",
4947
},
48+
local_wheel_inclusion_list = [
49+
"enzyme_ad*",
50+
]
5051
)
5152

5253
load("@xla//third_party/py:python_init_toolchains.bzl", "python_init_toolchains")
@@ -55,16 +56,8 @@ python_init_toolchains()
5556
load("@xla//third_party/py:python_init_pip.bzl", "python_init_pip")
5657
python_init_pip()
5758

58-
load("@xla//third_party/py:python_init_rules.bzl", "python_init_rules")
59-
python_init_rules()
60-
61-
load("@rules_python//python:repositories.bzl", "py_repositories")
62-
63-
py_repositories()
64-
65-
load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies")
66-
67-
pip_install_dependencies()
59+
load("@pypi//:requirements.bzl", "install_deps")
60+
install_deps()
6861

6962
http_archive(
7063
name = "enzyme",

builddeps/BUILD

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
licenses(["notice"])
2+
3+
load("@python//:defs.bzl", "compile_pip_requirements")
4+
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS")
5+
6+
compile_pip_requirements(
7+
name = "requirements",
8+
extra_args = [
9+
"--allow-unsafe",
10+
"--build-isolation",
11+
"--rebuild",
12+
],
13+
requirements_in = "requirements.in",
14+
requirements_txt = REQUIREMENTS,
15+
generate_hashes = True,
16+
data = ["test-requirements.txt"]
17+
)

0 commit comments

Comments
 (0)