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

Build against libomp14 for MacOS #692

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
42 changes: 28 additions & 14 deletions .github/workflows/wheel_macos_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
types: [published]

env:
MACOSX_DEPLOYMENT_TARGET: 10.15
MACOSX_DEPLOYMENT_TARGET: 11.0

concurrency:
group: wheel_macos_x86_64-${{ github.ref }}
Expand Down Expand Up @@ -45,13 +45,9 @@ jobs:
id: kokkos-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }}
path: ${{ github.workspace}}/ext_lib/
key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}

- name: Install clang
run: |
brew install libomp

- name: Clone Kokkos libs
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
Expand All @@ -63,22 +59,37 @@ jobs:
with:
python-version: '3.9'

- name: Install libomp-14
if: ${{ matrix.exec_model }} == "OPENMP"
run: |
python -m pip install cmake ninja
mkdir -p ${{ github.workspace}}/ext_lib/libomp_install/${{ matrix.exec_model }}
curl -L https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/openmp-14.0.6.src.tar.xz --output ${{ github.workspace }}/ext_lib/libomp_install/openmp-14.0.6.src.tar.xz
cd ${{ github.workspace }}/ext_lib/libomp_install/
tar xvf openmp-14.0.6.src.tar.xz
cd ${{ github.workspace }}/ext_lib/libomp_install/openmp-14.0.6.src
cmake -BBuild . \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++
cmake --build ./Build
cd Build && make DESTDIR=${{ github.workspace }}/ext_lib/libomp_install/ install

- name: Build Kokkos core library
if: steps.kokkos-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }}
mkdir -p ${{ github.workspace}}/ext_lib/Kokkos_install/${{ matrix.exec_model }}
cd kokkos
python -m pip install cmake ninja

cmake -BBuild . -DCMAKE_INSTALL_PREFIX=${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }} \
cmake -BBuild . -DCMAKE_INSTALL_PREFIX=${{ github.workspace}}/ext_lib/Kokkos_install/${{ matrix.exec_model }} \
-DKokkos_ENABLE_COMPLEX_ALIGN=OFF \
-DKokkos_ENABLE_SERIAL=ON \
-DKokkos_ENABLE_${{ matrix.exec_model }}=ON \
-DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_CXX_COMPILER=g++ \
-DOpenMP_ROOT=$(brew --prefix libomp) \
-DOpenMP_ROOT=${{ github.workspace}}/ext_lib/libomp_install/usr/local/ \
-G Ninja
cmake --build ./Build --verbose
cmake --install ./Build
Expand Down Expand Up @@ -107,13 +118,15 @@ jobs:
id: kokkos-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }}
path: ${{ github.workspace}}/ext_lib/
key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}

- name: Copy cached libraries
if: steps.kokkos-cache.outputs.cache-hit == 'true'
run: |
mkdir Kokkos
cp -rf ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/
mkdir Kokkos OpenMP
cp -rf ${{ github.workspace }}/ext_lib/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/
#cp -rf ${{ github.workspace }}/ext_lib/libomp_install/* OpenMP/

- uses: actions/setup-python@v5
name: Install Python
Expand All @@ -130,14 +143,15 @@ jobs:
# MacOS specific build settings
CIBW_BEFORE_ALL_MACOS: |
brew uninstall --force oclint
brew install libomp

# Python build settings
CIBW_BEFORE_BUILD: |
python -m pip install pybind11 ninja cmake~=3.24.0 setuptools scipy

PL_BACKEND: ${{ matrix.pl_backend }}

CMAKE_ARGS: "-DOpenMP_ROOT=${{ github.workspace}}/ext_lib/libomp_install/usr/local/"

CIBW_BEFORE_TEST: |
python -m pip install -r requirements-tests.txt
if ${{ matrix.pl_backend == 'lightning_kokkos'}}; then SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" pip install -e . -vv; fi
Expand Down Expand Up @@ -165,7 +179,7 @@ jobs:
regex: '.*[0-9]+.[0-9]+.[0-9]+[-_]?rc[0-9]+'

- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' || steps.rc_build.outputs.match != ''}}
#if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' || steps.rc_build.outputs.match != ''}}
with:
name: ${{ runner.os }}-wheels-${{ matrix.pl_backend }}-${{ matrix.arch }}.zip
path: ./wheelhouse/*.whl
Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.36.0-dev33"
__version__ = "0.36.0-dev35"