Skip to content

Commit

Permalink
Merge pull request #17 from unitaryfund/win_mac
Browse files Browse the repository at this point in the history
Fix Windows/Mac builds, for Catalyst
  • Loading branch information
WrathfulSpatula authored Jul 5, 2024
2 parents adb7f33 + 259a2a7 commit 7009942
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 68 deletions.
64 changes: 0 additions & 64 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,70 +137,6 @@ jobs:
name: pennylane_qrack-${{ matrix.platform }}
path: dist/

build_focal:
runs-on: ubuntu-20.04 # Use a Focal Fossa runner
strategy:
matrix:
platform:
- manylinux2014_x86_64
steps:
- name: Checkout PennyLane-Qrack
uses: actions/checkout@v4

- name: Checkout Qrack
uses: actions/checkout@v4
with:
repository: 'unitaryfund/qrack'
path: qrack

- name: Checkout Catalyst
uses: actions/checkout@v4
with:
repository: 'PennyLaneAI/catalyst'
path: catalyst

- name: Prepare Build Environment (Linux)
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake ocl-icd-opencl-dev opencl-headers python3-venv ninja-build libomp-dev
- name: Install Python Dependencies
run: |
mkdir venv
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
python -m pip install wheel setuptools
- name: Build Qrack Linux x86-64
run: |
cd qrack
mkdir build
cd build
cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DQBCAPPOW=12 -DCPP_STD=14 ..
sudo make install
- name: Build Catalyst Linux x86-64
run: |
source venv/bin/activate
cd catalyst
git submodule update --init --depth=1
pip install -r requirements.txt
make all
- name: Build Wheel
run: |
source venv/bin/activate
pip install -r requirements.txt
pip install .
python setup.py bdist_wheel --plat-name=${{ matrix.platform }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: pennylane_qrack-${{ matrix.platform }}
path: dist/

build_mac:
runs-on: macos-latest # Use a Mac OS runner
strategy:
Expand Down
14 changes: 10 additions & 4 deletions pennylane_qrack/qrack_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from pyqrack import QrackSimulator, Pauli

from ._version import __version__
from sys import platform as _platform

# tolerance for numerical errors
tolerance = 1e-10
Expand Down Expand Up @@ -145,10 +146,15 @@ class QrackDevice(QubitDevice):

@staticmethod
def get_c_interface():
return (
"QrackDevice",
os.path.dirname(sys.modules[__name__].__file__) + "/libqrack_device.so",
)
shared_lib_path = os.path.dirname(sys.modules[__name__].__file__) + "/libqrack_device.so"
if _platform == "win32":
shared_lib_path = os.path.dirname(sys.modules[__name__].__file__) + "/qrack_device.dll"
elif _platform == "darwin":
shared_lib_path = (
os.path.dirname(sys.modules[__name__].__file__) + "/libqrack_device.dylib"
)

return ("QrackDevice", shared_lib_path)

def __init__(self, wires=0, shots=None, **kwargs):
super().__init__(wires=wires, shots=shots)
Expand Down

0 comments on commit 7009942

Please sign in to comment.