From 562065c42702ef27016d850fa5e0a1f0ce8d1b45 Mon Sep 17 00:00:00 2001 From: Vincent Michaud-Rioux Date: Tue, 12 Sep 2023 13:19:29 -0400 Subject: [PATCH] Update PennyLane packages to v0.32. (#39688) * Update PennyLane packages to v0.32. * Reformat. * Couple small fixes. * Fix Lightning cmake_args. * Couple dep fixes in py-pennylane + plugins. * Fix scipy condition. * Add comment on conflicting requirement. --- .../py-pennylane-lightning-kokkos/package.py | 12 +++++++----- .../packages/py-pennylane-lightning/package.py | 14 ++++++++------ .../repos/builtin/packages/py-pennylane/package.py | 14 +++++++++----- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/var/spack/repos/builtin/packages/py-pennylane-lightning-kokkos/package.py b/var/spack/repos/builtin/packages/py-pennylane-lightning-kokkos/package.py index 4ad9f1c508..8871ac3027 100644 --- a/var/spack/repos/builtin/packages/py-pennylane-lightning-kokkos/package.py +++ b/var/spack/repos/builtin/packages/py-pennylane-lightning-kokkos/package.py @@ -13,12 +13,13 @@ class PyPennylaneLightningKokkos(CMakePackage, PythonExtension, CudaPackage, ROC homepage = "https://docs.pennylane.ai/projects/lightning-kokkos" git = "https://github.com/PennyLaneAI/pennylane-lightning-kokkos.git" - url = "https://github.com/PennyLaneAI/pennylane-lightning-kokkos/archive/refs/tags/v0.31.0.tar.gz" + url = "https://github.com/PennyLaneAI/pennylane-lightning-kokkos/archive/refs/tags/v0.32.0.tar.gz" maintainers("AmintorDusko", "vincentmr") version("main", branch="main") + version("0.32.0", sha256="06f19dfb1073387ef9ee30c38ea44884844a771373256b694a0e1ceb87195bb2") version("0.31.0", sha256="fe10322fee0fa7df45cd3a81d6c229a79c7dfa7f20ff7d67c65c9a28f494dc89") version("0.30.0", sha256="7c8f0e0431f8052993cd8033a316f53590c7bf5419445d0725e214b93cbc661b") version("0.29.1", sha256="f51ba7718defc7bb5064f690f381e04b2ec58cb09f22a171ae5f410860716e30") @@ -71,11 +72,12 @@ class PyPennylaneLightningKokkos(CMakePackage, PythonExtension, CudaPackage, ROC depends_on("py-pybind11", type="link") depends_on("py-pip", type="build") depends_on("py-wheel", type="build") + depends_on("py-pennylane@0.28:", type=("build", "run"), when="@:0.30") depends_on("py-pennylane@0.30:", type=("build", "run"), when="@0.31:") - depends_on("py-pennylane@0.28:", type=("build", "run"), when="@:0.30.0") - depends_on("py-pennylane-lightning@0.31:~kokkos", type=("build", "run"), when="@0.31.0:") - depends_on("py-pennylane-lightning@0.30:~kokkos", type=("build", "run"), when="@0.30.0:") - depends_on("py-pennylane-lightning@0.28:0.29~kokkos", type=("build", "run"), when="@0.29.1") + # This requirement differs from `pennylane>=0.30` in `setup.py`, + # but the introduction of `StatePrep` demands `pennylane>=0.32` + depends_on("py-pennylane@0.32:", type=("build", "run"), when="@0.32:") + depends_on("py-pennylane-lightning~kokkos", type=("build", "run"), when="@:0.31") # variant defined dependencies depends_on("llvm-openmp", when="+openmp %apple-clang") diff --git a/var/spack/repos/builtin/packages/py-pennylane-lightning/package.py b/var/spack/repos/builtin/packages/py-pennylane-lightning/package.py index 159e402f5d..5e931b9ac5 100644 --- a/var/spack/repos/builtin/packages/py-pennylane-lightning/package.py +++ b/var/spack/repos/builtin/packages/py-pennylane-lightning/package.py @@ -12,11 +12,12 @@ class PyPennylaneLightning(CMakePackage, PythonExtension): homepage = "https://docs.pennylane.ai/projects/lightning" git = "https://github.com/PennyLaneAI/pennylane-lightning.git" - url = "https://github.com/PennyLaneAI/pennylane-lightning/archive/refs/tags/v0.31.0.tar.gz" + url = "https://github.com/PennyLaneAI/pennylane-lightning/archive/refs/tags/v0.32.0.tar.gz" maintainers("mlxd", "AmintorDusko") version("master", branch="master") + version("0.32.0", sha256="124edae1828c7e72e7b3bfbb0e75e98a07a490d7f1eab19eebb3311bfa8a23d4") version("0.31.0", sha256="b177243625b6fdac0699d163bbc330c92ca87fb9f427643785069273d2a255f6") version("0.30.0", sha256="0f4032409d20d00991b5d14fe0b2b928baca4a13c5a1b16eab91f61f9273e58d") version("0.29.0", sha256="da9912f0286d1a54051cc19cf8bdbdcd732795636274c95f376db72a88e52d85") @@ -27,7 +28,7 @@ class PyPennylaneLightning(CMakePackage, PythonExtension): default=True, description="Build with AVX2/AVX512 gate automatic dispatching support", ) - variant("kokkos", default=True, description="Build with Kokkos support") + variant("kokkos", default=True, description="Build with Kokkos support", when="@:0.31") variant("openmp", default=True, description="Build with OpenMP support") variant("native", default=False, description="Build natively for given hardware") @@ -44,11 +45,12 @@ class PyPennylaneLightning(CMakePackage, PythonExtension): # variant defined dependencies depends_on("blas", when="+blas") - depends_on("kokkos@:4.0.01", when="+kokkos") - depends_on("kokkos-kernels@:4.0.01", when="+kokkos") + depends_on("kokkos@:4.0.01", when="@:0.31+kokkos") + depends_on("kokkos-kernels@:4.0.01", when="@:0.31+kokkos") depends_on("llvm-openmp", when="+openmp %apple-clang") - depends_on("python@3.8:", type=("build", "run")) + depends_on("python@3.8:", type=("build", "run"), when="@:0.31") + depends_on("python@3.9:", type=("build", "run"), when="@0.32:") depends_on("py-setuptools", type="build") depends_on("py-numpy", type=("build", "run")) depends_on("py-pybind11", type="link") @@ -80,7 +82,7 @@ def cmake_args(self): f"-DKokkos_Core_DIR={self.spec['kokkos'].home}", f"-DKokkos_Kernels_DIR={self.spec['kokkos-kernels'].home}", ] - else: + elif self.spec.version < Version("0.32"): args += ["-DENABLE_KOKKOS=OFF"] return args diff --git a/var/spack/repos/builtin/packages/py-pennylane/package.py b/var/spack/repos/builtin/packages/py-pennylane/package.py index c4c75e85f2..e3bc536ae9 100644 --- a/var/spack/repos/builtin/packages/py-pennylane/package.py +++ b/var/spack/repos/builtin/packages/py-pennylane/package.py @@ -12,21 +12,24 @@ class PyPennylane(PythonPackage): homepage = "https://docs.pennylane.ai/" git = "https://github.com/PennyLaneAI/pennylane.git" - url = "https://github.com/PennyLaneAI/pennylane/archive/refs/tags/v0.31.0.tar.gz" + url = "https://github.com/PennyLaneAI/pennylane/archive/refs/tags/v0.32.0.tar.gz" maintainers("mlxd", "AmintorDusko", "marcodelapierre") version("master", branch="master") + version("0.32.0", sha256="8a2206268d7cae0a59f9067b6075175eec93f4843519b371f02716c49a22e750") version("0.31.0", sha256="f3b68700825c120e44434ed2b2ab71d0be9d3111f3043077ec0598661ec33477") version("0.30.0", sha256="7fe4821fbc733e3e40d7011e054bd2e31edde3151fd9539025c827a5a3579d6b") version("0.29.1", sha256="6ecfb305a3898347df8c539a89a67e748766941d159dbef9e34864872f13c45c") - depends_on("python@3.8:", type=("build", "run")) + depends_on("python@3.8:", type=("build", "run"), when="@:0.31.0") + depends_on("python@3.9:", type=("build", "run"), when="@0.32.0:") depends_on("py-pip", type=("build", "run")) # Runtime req for pennylane.about() depends_on("py-setuptools", type="build") depends_on("py-numpy@:1.23", type=("build", "run")) - depends_on("py-scipy@:1.10", type=("build", "run")) + depends_on("py-scipy", type=("build", "run")) + depends_on("py-scipy@:1.10", type=("build", "run"), when="@:0.31.0") depends_on("py-networkx", type=("build", "run")) depends_on("py-rustworkx", type=("build", "run"), when="@0.30.0:") depends_on("py-retworkx", type=("build", "run"), when="@0.28.0:0.29.1") @@ -36,12 +39,13 @@ class PyPennylane(PythonPackage): depends_on("py-semantic-version@2.7:", type=("build", "run")) depends_on("py-autoray@0.3.1:", type=("build", "run")) depends_on("py-cachetools", type=("build", "run")) - depends_on("py-pennylane-lightning@0.31.0:", type=("build", "run"), when="@0.31.0:") - depends_on("py-pennylane-lightning@0.30.0:", type=("build", "run"), when="@0.30.0:") + for v in range(30, 33): + depends_on(f"py-pennylane-lightning@0.{v}.0:", type=("build", "run"), when=f"@0.{v}.0:") depends_on( "py-pennylane-lightning@0.28.0:0.29.0", type=("build", "run"), when="@0.28.0:0.29.1" ) depends_on("py-requests", type=("build", "run")) + depends_on("py-typing-extensions", type=("build", "run"), when="@0.32.0:") # Test deps depends_on("py-pytest", type="test")