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

Caching Kokkos build for wheel-builds #316

Merged
merged 114 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from 111 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
27252f6
caching Kokkos build manylinux2014_x86_64
AmintorDusko Jul 21, 2022
24d45db
Auto update version
chaeyeunpark Jul 21, 2022
8a84dd8
Trigger CI
AmintorDusko Jul 21, 2022
3bb479b
Merge branch 'improvement/Kokkos-caching' of github.com:PennyLaneAI/p…
AmintorDusko Jul 21, 2022
a2de98c
Copy cached library to wheelbuilder repo dir
mlxd Jul 25, 2022
d810d33
Update path in CI
mlxd Jul 25, 2022
8800f85
Remove nested container
mlxd Jul 25, 2022
3e1bde5
Re-enable nested container
mlxd Jul 25, 2022
768bfc2
Once again change paths
mlxd Jul 25, 2022
ea27555
Interface to kokkos build
mlxd Jul 25, 2022
d8edbb8
Add logging
mlxd Jul 25, 2022
8864a2b
Add logging +1
mlxd Jul 25, 2022
82b4a27
Avoid missing URLs and log more in CMake
mlxd Jul 25, 2022
c69a5f3
Re-add public repos
mlxd Jul 25, 2022
a1de5bb
CMake explicit values
mlxd Jul 25, 2022
a80b5e3
Fix paths, reduce timeout window, fix target options
mlxd Jul 25, 2022
c768fac
Invalidate old CI cache key
mlxd Jul 25, 2022
af8c533
Trigger CI
mlxd Jul 25, 2022
cf9ac79
Increase timeout time for yum repos
mlxd Jul 25, 2022
7c503b6
Remove unneeded packages from x86 builder
mlxd Jul 26, 2022
7a90951
Add cahcing and build test to PPC image
mlxd Jul 26, 2022
1211e19
Auto update version
chaeyeunpark Jul 26, 2022
5937717
Merge branch 'master' into improvement/Kokkos-caching
mlxd Jul 26, 2022
4a98ba4
Trigger CI
mlxd Jul 26, 2022
b8e4f37
Trigger CI
mlxd Jul 26, 2022
59e1c75
Enable PPC workflow
mlxd Jul 26, 2022
486470b
Fix PPC builder
mlxd Jul 26, 2022
27c74e6
Avoid building in the PPC container until necessary
mlxd Jul 26, 2022
eba0a98
Redefine image for building
mlxd Jul 26, 2022
6dfbfb8
Add docker to container
mlxd Jul 26, 2022
d79e15a
.
mlxd Jul 26, 2022
0f9d47c
.
mlxd Jul 26, 2022
e39061e
Remove TTY support in builder
mlxd Jul 26, 2022
882297a
.
mlxd Jul 26, 2022
81c4c94
Remove redundant mkdir
mlxd Jul 26, 2022
091bb6c
Reorder checkout command
mlxd Jul 26, 2022
96b9a78
Rename python exec on ubuntu runner
mlxd Jul 26, 2022
d835735
Add aarch64 cache and builder support
mlxd Jul 26, 2022
5bbb8eb
Add aarch64 cache and builder support again
mlxd Jul 26, 2022
e439969
Add aarch64 cache and builder support final time
mlxd Jul 26, 2022
c2c794e
Remove redundant steps
mlxd Jul 26, 2022
810884f
Remove redundant steps again
mlxd Jul 26, 2022
d3a21ce
Avoid path modification in container
mlxd Jul 26, 2022
c8c25cb
Merge branch 'master' into improvement/Kokkos-caching
mlxd Jul 28, 2022
d6d7fdd
Auto update version
chaeyeunpark Jul 28, 2022
e70bd2a
Trigger CI
mlxd Jul 28, 2022
e578190
Add caching to MacOS wheels
mlxd Jul 29, 2022
bde52d1
Add OMP Macos Kokkos build
mlxd Jul 29, 2022
289a5eb
Fix CI deps
mlxd Jul 29, 2022
09cd791
Fix CI deps
mlxd Jul 29, 2022
b69aa8a
Fix CI deps
mlxd Jul 29, 2022
36b6953
Fix missing macos cache load
mlxd Jul 29, 2022
d141e79
Update chacing paths for macos
mlxd Jul 29, 2022
6868780
Update chacing paths for macos
mlxd Jul 29, 2022
948529d
Update merge
mlxd Aug 3, 2022
62bf583
Update merge CI
mlxd Aug 3, 2022
554c35a
Auto update version
chaeyeunpark Aug 3, 2022
533524d
Retrigger CI
mlxd Aug 3, 2022
5dc7ccf
Update MacOS builder
mlxd Aug 3, 2022
1146e10
Update linux actions
mlxd Aug 3, 2022
ba3afe6
Update json formatting
mlxd Aug 3, 2022
89be4c3
merge master
AmintorDusko Aug 11, 2022
20d2994
Auto update version
chaeyeunpark Aug 11, 2022
7c2e25f
Trigger CI
AmintorDusko Aug 11, 2022
4b0b1ca
Merge branch 'improvement/Kokkos-caching' of github.com:PennyLaneAI/p…
AmintorDusko Aug 11, 2022
f1d748b
fix format
AmintorDusko Aug 11, 2022
c7edafd
Trim trailling whitespaces
AmintorDusko Aug 11, 2022
b4e51c8
re-format files
AmintorDusko Aug 11, 2022
e40960e
Merge master
AmintorDusko Aug 12, 2022
e400a01
update linux wheel
AmintorDusko Aug 15, 2022
3d42fd3
merge master
AmintorDusko Aug 15, 2022
726c1cb
update cmake file
AmintorDusko Aug 15, 2022
87fc8cd
update setup
AmintorDusko Aug 16, 2022
6f615a8
update cmake files
AmintorDusko Aug 16, 2022
0aaa9c0
update Kokkos build
AmintorDusko Aug 16, 2022
d4bf014
clean cmake file
AmintorDusko Aug 16, 2022
a91f19e
add cache version
AmintorDusko Aug 16, 2022
0a1bbca
add dev label to caching
AmintorDusko Aug 16, 2022
678fd68
make kernels libraries PIC
AmintorDusko Aug 16, 2022
10fe6b6
Fix CMake (#332)
chaeyeunpark Aug 16, 2022
523f306
fix and test wheels
AmintorDusko Aug 16, 2022
3a437a6
Merge branch 'improvement/Kokkos-caching' of github.com:PennyLaneAI/p…
AmintorDusko Aug 16, 2022
4ceb450
remove cache dev flag
AmintorDusko Aug 16, 2022
d55c72a
update wheels and check caching
AmintorDusko Aug 17, 2022
f0bb5b6
update macos_arm64 wheel
AmintorDusko Aug 17, 2022
9159aba
update windows wheel
AmintorDusko Aug 17, 2022
1fa5354
Trigger CI
AmintorDusko Aug 17, 2022
e3a2b2e
Merge branch 'master' into improvement/Kokkos-caching
AmintorDusko Aug 18, 2022
e204675
improve process_options file
AmintorDusko Aug 22, 2022
f2b271b
isolate Kokkos installation
AmintorDusko Aug 22, 2022
2d140f7
small fix
AmintorDusko Aug 22, 2022
08f244c
Merge branch 'improvement/Kokkos-caching' of github.com:PennyLaneAI/p…
AmintorDusko Aug 22, 2022
2ed4587
remove workflows tests
AmintorDusko Aug 22, 2022
eb5302b
Merge branch 'master' into improvement/Kokkos-caching
AmintorDusko Aug 22, 2022
8728bf8
update version
AmintorDusko Aug 22, 2022
c283c95
Merge branch 'master' into improvement/Kokkos-caching
AmintorDusko Aug 22, 2022
be76d45
Trigger CI
AmintorDusko Aug 22, 2022
0b8d21c
Merge branch 'improvement/Kokkos-caching' of github.com:PennyLaneAI/p…
AmintorDusko Aug 22, 2022
4d14050
Trigger CI
AmintorDusko Aug 22, 2022
81378f3
Trigger CI
AmintorDusko Aug 22, 2022
1579769
Merge branch 'master' into improvement/Kokkos-caching
AmintorDusko Aug 23, 2022
e08f259
version
AmintorDusko Aug 23, 2022
3853cb4
add caching to windows wheel
AmintorDusko Aug 23, 2022
28ccf13
make windows build type release
AmintorDusko Aug 23, 2022
c913365
upgrade cibuildwheel
AmintorDusko Aug 23, 2022
f88b402
verbose mode
AmintorDusko Aug 24, 2022
a79d8d8
merge master
AmintorDusko Aug 24, 2022
3dc4b85
update version
AmintorDusko Aug 24, 2022
0cbe9b3
fix windows wheel build
AmintorDusko Aug 24, 2022
eb6471c
Trigger CI
AmintorDusko Aug 24, 2022
c2f2b0e
Trigger CI
AmintorDusko Aug 24, 2022
4572bc4
apply review suggestions
AmintorDusko Aug 24, 2022
3586518
bring python version back
AmintorDusko Aug 24, 2022
3c10c05
improve setup
AmintorDusko Aug 25, 2022
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
158 changes: 135 additions & 23 deletions .github/workflows/wheel_linux_aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:

jobs:
linux-set-matrix-aarch64:
name: Set builder matrix versions
name: Set builder matrix
runs-on: ubuntu-latest

steps:
Expand All @@ -29,7 +29,8 @@ jobs:

- uses: actions/checkout@v2

- id: pyver
- name: Python version
id: pyver
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
Expand All @@ -41,17 +42,119 @@ jobs:
--max-version=3.${{ env.PYTHON3_MAX_VERSION }} \
--range)"
fi

- name: Kokkos execution strategy
id: exec_model
run: echo "::set-output name=exec_model::[\"SERIAL\"]" # We may also adopt [OPENMP, THREADS] in later iterations

- name: Kokkos version
id: kokkos_version
run: echo "::set-output name=kokkos_version::[\"3.6.00\"]"

outputs:
matrix: ${{ steps.pyver.outputs.matrix }}
exec_model: ${{ steps.exec_model.outputs.exec_model }}
kokkos_version: ${{ steps.kokkos_version.outputs.kokkos_version }}

linux-wheels-aarch64:
build_dependencies:
needs: [linux-set-matrix-aarch64]
strategy:
matrix:
os: [ubuntu-latest]
arch: [aarch64]
exec_model: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.kokkos_version) }}
container_img: ["quay.io/pypa/manylinux2014_aarch64"]

name: Kokkos core & kernels (${{ matrix.exec_model }}::${{ matrix.arch }} )
runs-on: ${{ matrix.os }}

steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.4.1
with:
access_token: ${{ github.token }}

- name: Cache installation directories
id: kokkos-cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}
key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}

- name: Clone Kokkos libs
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/kokkos/kokkos.git
cd kokkos
git checkout ${{ matrix.kokkos_version }}
cd -
pushd . &> /dev/null
git clone https://github.com/kokkos/kokkos-kernels.git
cd kokkos-kernels
git checkout ${{ matrix.kokkos_version }}
cd -

- uses: docker/setup-qemu-action@v2
name: Set up QEMU

- name: Build Kokkos core library
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}
cd kokkos
docker run --platform linux/aarch64 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/io \
-v ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}:/install \
-i ${{ matrix.container_img }} \
bash -c "cd /io && \
python3.7 -m pip install ninja && \
ln -s /opt/python/cp37-cp37m/bin/ninja /usr/bin/ninja && \
cmake -BBuild . -DCMAKE_INSTALL_PREFIX=/install \
-DKokkos_ENABLE_COMPLEX_ALIGN=OFF \
-DKokkos_ENABLE_${{ matrix.exec_model }}=ON \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-G Ninja && \
cmake --build ./Build --verbose && \
cmake --install ./Build; "
cd -
- name: Build Kokkos kernels library
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
cd kokkos-kernels
docker run --platform linux/aarch64 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/io \
-v ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}:/install \
-i ${{ matrix.container_img }} \
bash -c "cd /io && \
python3.7 -m pip install ninja && \
ln -s /opt/python/cp37-cp37m/bin/ninja /usr/bin/ninja && \
cmake -BBuild . -DCMAKE_INSTALL_PREFIX=/install \
-DKokkos_ENABLE_${{ matrix.exec_model }}=ON \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_PREFIX_PATH=/install \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-G Ninja && \
cmake --build ./Build --verbose && \
cmake --install ./Build; "
cd -

linux-wheels-aarch64:
needs: [linux-set-matrix-aarch64, build_dependencies]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [aarch64]
cibw_build: ${{fromJson(needs.linux-set-matrix-aarch64.outputs.matrix)}}
cibw_build: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.matrix) }}
exec_model: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.kokkos_version) }}
container_img: ["quay.io/pypa/manylinux2014_aarch64"]

name: ubuntu-latest::aarch64 (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }})
runs-on: ${{ matrix.os }}
Expand All @@ -62,41 +165,50 @@ jobs:
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- uses: docker/setup-qemu-action@v1
name: Set up QEMU
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
name: Install Python
- name: Restoring cached dependencies
id: kokkos-cache
uses: actions/cache@v3
with:
python-version: '3.7'
path: ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}
key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}

- name: Copy cached libraries
run: |
mkdir Kokkos
cp -rf ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.3.0
run: python3 -m pip install cibuildwheel==2.8.1

- uses: docker/setup-qemu-action@v2
name: Set up QEMU

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS_LINUX: ${{matrix.arch}}

CIBW_BUILD: ${{ matrix.cibw_build }}

CIBW_SKIP: "*-musllinux*"

# Python build settings
CIBW_BEFORE_BUILD: |
pip install pybind11 ninja cmake && yum install -y gcc gcc-c++
cat /etc/yum.conf | sed "s/\[main\]/\[main\]\ntimeout=5/g" > /etc/yum.conf
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
pip install ninja cmake

# Testing of built wheels
CIBW_TEST_REQUIRES: numpy~=1.21 scipy pytest pytest-cov pytest-mock flaky

CIBW_BEFORE_TEST: pip install git+https://github.com/PennyLaneAI/pennylane.git@master
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014

CIBW_TEST_COMMAND: |
pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report
CIBW_BUILD_VERBOSITY: 3

# Use Centos 7 wheel-builder for ARM
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
run: python3 -m cibuildwheel --output-dir wheelhouse

CIBW_ARCHS_LINUX: ${{matrix.arch}}
- uses: actions-ecosystem/action-regex-match@v2
id: rc_build
with:
text: ${{ github.event.pull_request.head.ref }}
regex: '.*[0-9]+.[0-9]+.[0-9]+[-_]?rc[0-9]+'

- uses: actions/upload-artifact@v2
if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }}
Expand Down
Loading