Add BLAS_LIB_PATH as ENV var (#822)

* AER_BLAS_LIB_PATH as env var
* Update contributing guide
This commit is contained in:
Victor Villar 2020-07-22 15:19:52 +02:00 committed by GitHub
parent c26fe542e7
commit 06c18a0419
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 8 deletions

View File

@ -15,6 +15,10 @@ project(qasm_simulator VERSION ${VERSION_NUM} LANGUAGES CXX C)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/cmake)
if(NOT DEFINED AER_BLAS_LIB_PATH AND DEFINED ENV{AER_BLAS_LIB_PATH})
set(AER_BLAS_LIB_PATH $ENV{AER_BLAS_LIB_PATH})
endif()
# Warning: Because of a bug on CMake's FindBLAS or (it's not clear whoes fault is)
# libopenblas.a for Ubuntu (maybe others) we need to copy the file:
# cmake/FindBLAS.cmake.fix-static-linking, to the directory were CMake Modules are
@ -157,8 +161,8 @@ if(STATIC_LINKING)
set(BLA_STATIC TRUE)
endif()
if(BLAS_LIB_PATH)
find_BLAS_in_specific_path(${BLAS_LIB_PATH})
if(AER_BLAS_LIB_PATH)
find_BLAS_in_specific_path(${AER_BLAS_LIB_PATH})
else()
set(BLAS_LIBRARIES CONAN_PKG::openblas)
endif()

View File

@ -369,7 +369,7 @@ Because the standalone version of `Aer` doesn't need Python at all, the build sy
based on CMake, just like most of other C++ projects. So in order to pass all the different
options we have on `Aer` to CMake we use it's native mechanism:
qiskit-aer/out$ cmake -DCMAKE_CXX_COMPILER=g++-9 -DBLAS_LIB_PATH=/path/to/my/blas ..
qiskit-aer/out$ cmake -DCMAKE_CXX_COMPILER=g++-9 -DAER_BLAS_LIB_PATH=/path/to/my/blas ..
### macOS
@ -457,7 +457,7 @@ Because the standalone version of `Aer` doesn't need Python at all, the build sy
based on CMake, just like most of other C++ projects. So in order to pass all the different
options we have on `Aer` to CMake we use it's native mechanism:
qiskit-aer/out$ cmake -DCMAKE_CXX_COMPILER=g++-9 -DBLAS_LIB_PATH=/path/to/my/blas ..
qiskit-aer/out$ cmake -DCMAKE_CXX_COMPILER=g++-9 -DAER_BLAS_LIB_PATH=/path/to/my/blas ..
@ -552,7 +552,7 @@ Because the standalone version of `Aer` doesn't need Python at all, the build sy
based on CMake, just like most of other C++ projects. So in order to pass all the different
options we have on `Aer` to CMake we use it's native mechanism:
(QiskitDevEnv) qiskit-aer\out> cmake -G "Visual Studio 15 2017" -DBLAS_LIB_PATH=c:\path\to\my\blas ..
(QiskitDevEnv) qiskit-aer\out> cmake -G "Visual Studio 15 2017" -DAER_BLAS_LIB_PATH=c:\path\to\my\blas ..
### Building with GPU support
@ -622,14 +622,16 @@ These are the flags:
Default: No value.
Example: ``python ./setup.py bdist_wheel -- -DUSER_LIB_PATH=C:\path\to\openblas\libopenblas.so``
* BLAS_LIB_PATH
* AER_BLAS_LIB_PATH
Tells CMake the directory to look for the BLAS library instead of the usual paths.
If no BLAS library is found under that directory, CMake will raise an error and stop.
It can also be set as an ENV variable with the same name, although the flag takes precedence.
Values: An absolute path.
Default: No value.
Example: ``python ./setup.py bdist_wheel -- -DBLAS_LIB_PATH=/path/to/look/for/blas/``
Example: ``python ./setup.py bdist_wheel -- -DAER_BLAS_LIB_PATH=/path/to/look/for/blas/``
* BUILD_TESTS

View File

@ -26,7 +26,7 @@ macro(setup_conan)
set(CONAN_OPTIONS ${CONAN_OPTIONS} "thrust:device_system=${THRUST_BACKEND}")
endif()
if(NOT BLAS_LIB_PATH)
if(NOT AER_BLAS_LIB_PATH)
set(REQUIREMENTS ${REQUIREMENTS} openblas/0.3.7)
endif()