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 support for Scipy v1.14 #776

Merged
merged 7 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
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.37.0-dev46"
__version__ = "0.37.0-dev47"
18 changes: 14 additions & 4 deletions pennylane_lightning/core/src/utils/UtilLinearAlg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,19 @@ void compute_diagonalizing_gates(int n, int lda,
std::vector<T> rwork(3 * n - 2); // Real workspace array
int info;

// Scipy packages `libopenblas` as `libscipy_openblas` starting v1.14.0, and
// OpenBlas symbols are now exposed with a prefix `scipy_`.
const auto scipy_openblas =
std::find_if(availableLibs.begin(), availableLibs.end(),
[](const auto &lib) {
return lib.find("scipy_openblas") != std::string::npos;
}) != availableLibs.end()
? true
: false;

if constexpr (std::is_same<T, float>::value) {
cheevPtr cheev =
reinterpret_cast<cheevPtr>(blasLib->getSymbol("cheev_"));
cheevPtr cheev = reinterpret_cast<cheevPtr>(
blasLib->getSymbol(scipy_openblas ? "scipy_cheev_" : "cheev_"));
// Query optimal workspace size
cheev(&jobz, &uplo, &n, ah.data(), &lda, eigenVals.data(),
work_query.data(), &lwork, rwork.data(), &info);
Expand All @@ -205,8 +215,8 @@ void compute_diagonalizing_gates(int n, int lda,
cheev(&jobz, &uplo, &n, ah.data(), &lda, eigenVals.data(),
work_optimal.data(), &lwork, rwork.data(), &info);
} else {
zheevPtr zheev =
reinterpret_cast<zheevPtr>(blasLib->getSymbol("zheev_"));
zheevPtr zheev = reinterpret_cast<zheevPtr>(
blasLib->getSymbol(scipy_openblas ? "scipy_zheev_" : "zheev_"));
// Query optimal workspace size
zheev(&jobz, &uplo, &n, ah.data(), &lda, eigenVals.data(),
work_query.data(), &lwork, rwork.data(), &info);
Expand Down
3 changes: 2 additions & 1 deletion pennylane_lightning/core/src/utils/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* Config file for the path to scipy.libs at compile time.
*/


#ifndef CONFIG_H
#define CONFIG_H
#define SCIPY_LIBS_PATH ""
#define SCIPY_LIBS_PATH "/home/ali/miniforge3/envs/cat/lib/python3.11/site-packages/scipy.libs"
#endif
Loading