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

Add qiskit-aer (and muparserx) #21404

Merged
merged 11 commits into from
Feb 14, 2023
Merged
10 changes: 10 additions & 0 deletions recipes/muparserx/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

mkdir build_ && cd build_

cmake \
-DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_PREFIX_PATH=${PREFIX} \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_RPATH="${PREFIX}/lib" -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_MACOSX_RPATH=ON ..
make install -j${CPU_COUNT}
41 changes: 41 additions & 0 deletions recipes/muparserx/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% set name = "muparserx" %}
{% set version = "4.0.8" %}

package:
name: muparserx
version: {{ version }}

source:
url: https://github.com/beltoforion/{{ name }}/archive/refs/tags/v{{ version }}.tar.gz
sha256: 5913e0a4ca29a097baad1b78a4674963bc7a06e39ff63df3c73fbad6fadb34e1

build:
number: 0
skip: True # [win]
run_exports:
- {{ pin_subpackage('muparserx', max_pin='x.x') }}

requirements:
build:
- cmake
- make
- {{ compiler('cxx') }}
host:
- llvm-openmp # [osx]
test:
commands:
- test -f ${PREFIX}/include/muparserx/mpParser.h
- test -f ${PREFIX}/lib/libmuparserx${SHLIB_EXT}
- test -f ${PREFIX}/lib/pkgconfig/muparserx.pc
- test -f ${PREFIX}/share/cmake/muparserx/muparserxConfigVersion.cmake
- test -f ${PREFIX}/share/cmake/muparserx/muparserxConfig.cmake

about:
home: https://beltoforion.de/en/muparserx
license: BSD-2-Clause
license_file: License.txt
summary: A C++ Library for Parsing Expressions with Strings, Complex Numbers, Vectors, Matrices and more.

extra:
recipe-maintainers:
- wshanks
24 changes: 24 additions & 0 deletions recipes/qiskit-aer/0001-Drop-setup_requires.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 6bed2ead4e6670439d125294c036de84f387efc1 Mon Sep 17 00:00:00 2001
From: Will Shanks <willshanks@us.ibm.com>
Date: Sun, 18 Dec 2022 13:22:38 -0500
Subject: [PATCH] Drop setup_requires

---
setup.py | 1 -
1 file changed, 1 deletion(-)

diff --git a/setup.py b/setup.py
index aa5099ca..147c7ca8 100644
--- a/setup.py
+++ b/setup.py
@@ -132,7 +132,6 @@ setup(
],
python_requires=">=3.7",
install_requires=requirements,
- setup_requires=setup_requirements,
include_package_data=False,
package_data={"qiskit_aer": ["VERSION.txt"], "qiskit_aer.library": ["*.csv"]},
extras_require=extras_requirements,
--
2.38.1

76 changes: 76 additions & 0 deletions recipes/qiskit-aer/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{% set name = "qiskit-aer" %}
{% set version = "0.11.2" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/Qiskit/{{ name }}/archive/refs/tags/{{ version }}.tar.gz
sha256: d18aefd09971bfe2018dc78623ddf8a25bc0660f4fb0987a82c8e2a677bffc4e
patches:
# This patch is used to prevent scikit-build from trying to pip install cmake.
# It can be dropped when a version including
# https://github.com/Qiskit/qiskit-aer/pull/1693 is released, likely
# version 0.12.0.
- 0001-Drop-setup_requires.patch

build:
script: {{ PYTHON }} -m pip install . -vv
# Skip Windows build until qiskit-terra has a Windows build
# Skip macOS build until https://github.com/Qiskit/qiskit-aer/issues/1689 is addressed
skip: True # [win or osx]
number: 0
script_env:
- DISABLE_DEPENDENCY_INSTALL=ON
- DISABLE_CONAN=ON
- SKBUILD_CONFIGURE_OPTIONS="-GNinja"

requirements:
build:
- {{ compiler('cxx') }}
- cmake !=3.17,>=3.8
- libgomp # [linux]
- llvm-openmp # [osx]
- ninja
host:
- libblas
- liblapack
- muparserx =4.0.8
- nlohmann_json =3.1.2
- numpy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is NumPy header used at build time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was guessing so since it is in the `build-system.requires of qiskit-aer's pyproject.toml. The main simulator is in C++ with Python bindings, so I was thinking the numpy headers would be needed for passing state vector and density matrix results across that interface. I don't see any direct references to numpy headers in the code but I am not that familiar with pybind11 which might provide a layer between numpy and C++? I think the conversion is partially specified here.

- pip
- python
- pybind11
- scikit-build >=0.11.0
- setuptools >=40.1.0
- spdlog =1.5.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is this necessary? 1.5.0 is quite old.

Copy link
Contributor Author

@wshanks wshanks Feb 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely not. I took it from qiskit-aer's cmake configuration. Since then it was bumped to 1.9.2 in Qiskit/qiskit-aer#1637 without comment, so I assume the version bump was incidental and not related to the other code changes.

I am not sure what the best practice is here for conda. Since spdlog is a header only project, I was assuming it would only influence the aer binary and not the rest of the conda environment so it was best to mirror the upstream pin, but we could possibly use just set a minimum version?

Edit: so when the recipe bumps to the new version that specifies spdlog 1.9.2, I will update the spdlog version. The question is if it should be bumped early.

run:
- {{ pin_compatible('numpy') }}
- python
- qiskit-terra >=0.21.0
- scipy >=1.0

test:
source_files:
- .stestr.conf
- test/*
imports:
- qiskit_aer
commands:
- pip check
- stestr run
requires:
- ddt
- pip
- stestr

about:
home: https://github.com/Qiskit/qiskit-aer
summary: Qiskit Aer - High performance simulators for Qiskit
license: Apache-2.0
license_file: LICENSE.txt

extra:
recipe-maintainers:
- wshanks
carterbox marked this conversation as resolved.
Show resolved Hide resolved