Skip to content

Commit

Permalink
path change convention changes in BLASLib for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
multiphaseCFD committed Nov 13, 2024
1 parent f017a86 commit d8f7c83
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pennylane_lightning/core/src/utils/BLASLibLoaderManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,27 @@ class BLASLibLoaderManager {
"/System/Library/Frameworks/Accelerate.framework/Versions/Current/"
"Frameworks/vecLib.framework/libLAPACK.dylib";
#else
std::string get_scipylibs_path_worker_() {
static std::string get_scipylibs_path_worker_() {
if (std::filesystem::exists(SCIPY_OPENBLAS32_LIB)) {
return SCIPY_OPENBLAS32_LIB;
}
std::string scipyPathStr;
std::string currentPathStr(getPath());
#ifdef _MSC_VER
std::string site_packages_str("site-packages\\");
#else
std::string site_packages_str("site-packages/");
#endif

std::size_t str_pos = currentPathStr.find(site_packages_str);
if (str_pos != std::string::npos) {
scipyPathStr =
currentPathStr.substr(0, str_pos + site_packages_str.size());
#ifdef _MSC_VER
scipyPathStr += "scipy_openblas32\\lib";
#else
scipyPathStr += "scipy_openblas32/lib";
#endif
}

if (std::filesystem::exists(scipyPathStr)) {
Expand All @@ -119,7 +127,11 @@ class BLASLibLoaderManager {
}
} else {
try {
#ifdef _MSC_VER
scipyPathStr = currentPathStr + "..\\..\\scipy_openblas32\\lib";
#else
scipyPathStr = currentPathStr + "../../scipy_openblas32/lib";
#endif
// convert the relative path to absolute path
scipyPathStr =
std::filesystem::canonical(scipyPathStr).string();
Expand Down

0 comments on commit d8f7c83

Please sign in to comment.