Reputation: 91
I am trying to use BLAS++ with OpenBLAS. Everything works fine on Linux but now I want to make my lib a bit more cross-platform.
I have this minimal CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(test)
find_package(Git REQUIRED)
function(update_git_submodule dir)
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "When updating submodule ${dir}")
endif()
endfunction()
set(BLASPP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/blaspp)
update_git_submodule(${BLASPP_DIR})
add_subdirectory(${BLASPP_DIR})
BLAS++ is a git submodule. It clones successfully and CMake than lets BLAS++ search for any BLAS implementation. However the problem is that it does not find OpenBLAS:
BLAS++ requires a BLAS library and none was found. Ensure that it is accessible in environment variables $CPATH, $LIBRARY_PATH, and $LD_LIBRARY_PATH.
I tried setting all variables to the share\cmake
folder in powershell and also as CMake variables, nothing worked. Also when specifying BLA_VENDOR
in CMake it will not find OpenBLAS.
Here comes what I did with OpenBLAS:
I cloned the repo from github (outside of the actual project), built it and installed it. Now I have the build directory of CMake with the compiled OpenBLAS files and the files in C:\Program Files(x86). In the latter there is a folder share\cmake
with all the CMake scripts including OpenBLASConfig.cmake
to be able to find OpenBLAS.
CMake now has to find those scripts but as it seems it doesn't.
The question is actually how do I tell CMake globally to search in C:\Program Files(x86)\OpenBLAS\share\cmake
?
Any ideas? Thanks in advance!
EDIT
--debug-find
prints the following:
Call Stack (most recent call first):
CMakeLists.txt:4 (find_package)
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.36.1.windows.1")
CMake Debug Log at CMakeLists.txt:4 (find_package):
find_package considered the following paths for FindGit.cmake:
The file was found at
C:/Program Files/CMake/share/cmake-3.23/Modules/FindGit.cmake
-- Using CMAKE_INSTALL_PREFIX = C:/Program Files (x86)/test
CMake Error at external/blaspp/CMakeLists.txt:97 (set_property):
set_property could not find CACHE variable CMAKE_BUILD_TYPE. Perhaps it
has not yet been created.
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - NOTFOUND
-- Not building CUDA support in BLAS++
-- Looking for HIP/ROCm
CMake Debug Log at external/blaspp/CMakeLists.txt:293 (find_package):
find_package considered the following paths for Findrocblas.cmake:
C:/Program Files/CMake/share/cmake-3.23/Modules/Findrocblas.cmake
The file was not found.
<PackageName>_ROOT CMake variable [CMAKE_FIND_USE_PACKAGE_ROOT_PATH].
none
CMAKE_PREFIX_PATH variable [CMAKE_FIND_USE_CMAKE_PATH].
none
CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables
[CMAKE_FIND_USE_CMAKE_PATH].
none
Env variable rocblas_DIR [CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].
none
CMAKE_PREFIX_PATH env variable [CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].
none
CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env variables
[CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH].
none
Paths specified by the find_package HINTS option.
none
Standard system environment variables
[CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH].
C:/Program Files/PowerShell/7
C:/Windows/System32
C:/Windows
C:/Windows/System32/wbem
C:/Windows/System32/WindowsPowerShell/v1.0
C:/Windows/System32/OpenSSH
C:/Program Files (x86)/NVIDIA Corporation/PhysX/Common
C:/Program Files/NVIDIA Corporation/NVIDIA NvDLISR
C:/Program Files/Microsoft SQL Server/150/Tools/Binn
C:/Program Files/Git/cmd
C:/Program Files/dotnet
C:/Program Files/gs/gs9.56.1
C:/Program Files (x86)/TeX2img
C:/Program Files/Neovim
C:/Program Files/treesitter
C:/Program Files/ImageMagick-7.1.0-Q16-HDRI
C:/Program Files/LLVM
C:/texlive/2022/bin/win32
C:/Program Files/CMake
C:/Program Files/fzf
C:/Program Files (x86)/pkg-config
C:/Program Files (x86)/glib
C:/Program Files (x86)/gettext-runtime
C:/Users/steve/miniconda3
C:/Users/steve/miniconda3/Library/mingw-w64
C:/Users/steve/miniconda3/Library/usr
C:/Users/steve/miniconda3/Library
C:/Users/steve/miniconda3/Scripts
C:/Users/steve/scoop/shims
C:/Users/steve/AppData/Local/Microsoft/WindowsApps
C:/Users/steve/.dotnet/tools
CMake User Package Registry [CMAKE_FIND_USE_PACKAGE_REGISTRY].
none
CMake variables defined in the Platform file
[CMAKE_FIND_USE_CMAKE_SYSTEM_PATH].
C:/Program Files
C:/Program Files (x86)
C:/Program Files (x86)/test
CMake System Package Registry
[CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY].
none
Paths specified by the find_package PATHS option.
none
find_package considered the following locations for rocblas's Config
module:
C:/Program Files/PowerShell/7/rocblasConfig.cmake
C:/Program Files/PowerShell/7/rocblas-config.cmake
C:/Windows/System32/rocblasConfig.cmake
C:/Windows/System32/rocblas-config.cmake
C:/Windows/rocblasConfig.cmake
C:/Windows/rocblas-config.cmake
C:/Windows/System32/wbem/rocblasConfig.cmake
C:/Windows/System32/wbem/rocblas-config.cmake
C:/Windows/System32/WindowsPowerShell/v1.0/rocblasConfig.cmake
C:/Windows/System32/WindowsPowerShell/v1.0/rocblas-config.cmake
C:/Windows/System32/OpenSSH/rocblasConfig.cmake
C:/Windows/System32/OpenSSH/rocblas-config.cmake
C:/Program Files (x86)/NVIDIA Corporation/PhysX/Common/rocblasConfig.cmake
C:/Program Files (x86)/NVIDIA Corporation/PhysX/Common/rocblas-config.cmake
C:/Program Files/Microsoft SQL Server/150/Tools/Binn/rocblasConfig.cmake
C:/Program Files/Microsoft SQL Server/150/Tools/Binn/rocblas-config.cmake
C:/Program Files/Git/cmd/rocblasConfig.cmake
C:/Program Files/Git/cmd/rocblas-config.cmake
C:/Program Files/dotnet/rocblasConfig.cmake
C:/Program Files/dotnet/rocblas-config.cmake
C:/Program Files/gs/gs9.56.1/rocblasConfig.cmake
C:/Program Files/gs/gs9.56.1/rocblas-config.cmake
C:/Program Files (x86)/TeX2img/rocblasConfig.cmake
C:/Program Files (x86)/TeX2img/rocblas-config.cmake
C:/Program Files/Neovim/rocblasConfig.cmake
C:/Program Files/Neovim/rocblas-config.cmake
C:/Program Files/treesitter/rocblasConfig.cmake
C:/Program Files/treesitter/rocblas-config.cmake
C:/Program Files/ImageMagick-7.1.0-Q16-HDRI/rocblasConfig.cmake
C:/Program Files/ImageMagick-7.1.0-Q16-HDRI/rocblas-config.cmake
C:/Program Files/LLVM/rocblasConfig.cmake
C:/Program Files/LLVM/rocblas-config.cmake
C:/texlive/2022/bin/win32/rocblasConfig.cmake
C:/texlive/2022/bin/win32/rocblas-config.cmake
C:/Program Files/CMake/rocblasConfig.cmake
C:/Program Files/CMake/rocblas-config.cmake
C:/Program Files/fzf/rocblasConfig.cmake
C:/Program Files/fzf/rocblas-config.cmake
C:/Program Files (x86)/pkg-config/rocblasConfig.cmake
C:/Program Files (x86)/pkg-config/rocblas-config.cmake
C:/Program Files (x86)/glib/rocblasConfig.cmake
C:/Program Files (x86)/glib/rocblas-config.cmake
C:/Program Files (x86)/gettext-runtime/rocblasConfig.cmake
C:/Program Files (x86)/gettext-runtime/rocblas-config.cmake
C:/Users/steve/miniconda3/rocblasConfig.cmake
C:/Users/steve/miniconda3/rocblas-config.cmake
C:/Users/steve/miniconda3/Library/rocblasConfig.cmake
C:/Users/steve/miniconda3/Library/rocblas-config.cmake
C:/Users/steve/miniconda3/Library/cmake/rocblasConfig.cmake
C:/Users/steve/miniconda3/Library/cmake/rocblas-config.cmake
C:/Users/steve/miniconda3/Scripts/rocblasConfig.cmake
C:/Users/steve/miniconda3/Scripts/rocblas-config.cmake
C:/Users/steve/scoop/shims/rocblasConfig.cmake
C:/Users/steve/scoop/shims/rocblas-config.cmake
C:/Users/steve/AppData/Local/Microsoft/WindowsApps/rocblasConfig.cmake
C:/Users/steve/AppData/Local/Microsoft/WindowsApps/rocblas-config.cmake
C:/Program Files/rocblasConfig.cmake
C:/Program Files/rocblas-config.cmake
C:/Program Files/CMake/rocblasConfig.cmake
C:/Program Files/CMake/rocblas-config.cmake
C:/Program Files (x86)/rocblasConfig.cmake
C:/Program Files (x86)/rocblas-config.cmake
The file was not found.
-- Not building HIP/ROCm support in BLAS++
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
CMake Debug Log at external/blaspp/CMakeLists.txt:329 (find_package):
find_package considered the following paths for FindOpenMP.cmake:
The file was found at
C:/Program Files/CMake/share/cmake-3.23/Modules/FindOpenMP.cmake
-- blaspp_id = ab91e06
-- Looking for BLAS libraries and options
Skipping threaded MKL for non-GNU, non-Intel compiler with OpenMP
←[1mdefault (no library)←[22m
libs:
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mIntel MKL lp64, sequential, gfortran←[22m
libs: -lmkl_gf_lp64 -lmkl_sequential -lmkl_core
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mIntel MKL ilp64, sequential, gfortran←[22m
libs: -lmkl_gf_ilp64 -lmkl_sequential -lmkl_core
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mIntel MKL lp64, sequential, ifort←[22m
libs: -lmkl_intel_lp64 -lmkl_sequential -lmkl_core
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mIntel MKL ilp64, sequential, ifort←[22m
libs: -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mIBM ESSL int (lp64), multi-threaded, with OpenMP←[22m
libs: -lesslsmp
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mIBM ESSL int64 (ilp64), multi-threaded, with OpenMP←[22m
libs: -lesslsmp6464
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mIBM ESSL int (lp64), sequential←[22m
libs: -lessl
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mIBM ESSL int64 (ilp64), sequential←[22m
libs: -lessl6464
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mOpenBLAS←[22m
libs: -lopenblas
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mApple Accelerate←[22m
libs: -framework Accelerate
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mgeneric←[22m
libs: -lblas
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mAMD ACML threaded←[22m
libs: -lacml_mp
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[1mAMD ACML sequential←[22m
libs: -lacml
-DBLAS_FORTRAN_ADD_ ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_LOWER ←[31m no (didn't link: routine not found)←[39m
-DBLAS_FORTRAN_UPPER ←[31m no (didn't link: routine not found)←[39m
←[31m BLAS library not found.←[39m
CMake Error at external/blaspp/CMakeLists.txt:374 (message):
BLAS++ requires a BLAS library and none was found. Ensure that it is
accessible in environment variables $CPATH, $LIBRARY_PATH, and
$LD_LIBRARY_PATH.
-- Configuring incomplete, errors occurred!
Upvotes: 1
Views: 2251
Reputation: 582
BLAS++ isn't looking for a BLAS library in a CMake package, it's just looking for a library that it can link to, e.g., on Unix something like -lblas
which would match libblas.so
or libblas.a
in the compiler's library search path.
You could hard-code the whole path when calling CMake, something like
cmake -DBLAS_LIBRARIES=/path/to/openblas/lib/libopenblas.so ..
I'm not familiar with how to specify that in CMake on Windows.
BTW, you can get rid of the ←[31m
ANSI color codes by setting color=no
.
Upvotes: 2