From b23527bf02d193cef9c6bc753851c5ab62c21d89 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 30 Jun 2016 17:07:38 +0300 Subject: [PATCH 1/2] core: fix arguments types for cblas calls --- modules/core/src/hal_internal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/core/src/hal_internal.cpp b/modules/core/src/hal_internal.cpp index 096ac0b400..07054f1d6c 100644 --- a/modules/core/src/hal_internal.cpp +++ b/modules/core/src/hal_internal.cpp @@ -399,9 +399,9 @@ lapack_gemm_c(const fptype *src1, size_t src1_step, const fptype *src2, size_t s set_value((std::complex*)dst, lddst, std::complex(0.0, 0.0), d_m, d_n); if(typeid(fptype) == typeid(float)) - cblas_cgemm(CblasRowMajor, transA, transB, a_m, d_n, a_n, &cAlpha, (void*)src1, ldsrc1, (void*)src2, ldsrc2, &cBeta, (void*)dst, lddst); + cblas_cgemm(CblasRowMajor, transA, transB, a_m, d_n, a_n, (float*)reinterpret_cast(cAlpha), (float*)src1, ldsrc1, (float*)src2, ldsrc2, (float*)reinterpret_cast(cBeta), (float*)dst, lddst); else if(typeid(fptype) == typeid(double)) - cblas_zgemm(CblasRowMajor, transA, transB, a_m, d_n, a_n, &cAlpha, (void*)src1, ldsrc1, (void*)src2, ldsrc2, &cBeta, (void*)dst, lddst); + cblas_zgemm(CblasRowMajor, transA, transB, a_m, d_n, a_n, (double*)reinterpret_cast(cAlpha), (double*)src1, ldsrc1, (double*)src2, ldsrc2, (double*)reinterpret_cast(cBeta), (double*)dst, lddst); return CV_HAL_ERROR_OK; } From ee4f409584cdc3910229d389cd09f9c7f3d63fe7 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Thu, 30 Jun 2016 17:10:27 +0300 Subject: [PATCH 2/2] cmake: lapack optimized code requires cblas.h --- cmake/OpenCVFindLibsPerf.cmake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/OpenCVFindLibsPerf.cmake b/cmake/OpenCVFindLibsPerf.cmake index 59ee42d32c..c679102d37 100644 --- a/cmake/OpenCVFindLibsPerf.cmake +++ b/cmake/OpenCVFindLibsPerf.cmake @@ -6,14 +6,17 @@ if(WITH_LAPACK) find_package(LAPACK) if(LAPACK_FOUND) - find_path(LAPACK_INCLUDE_DIR "lapacke.h") - if(LAPACK_INCLUDE_DIR) + find_path(LAPACKE_INCLUDE_DIR "lapacke.h") + if(LAPACKE_INCLUDE_DIR) + find_path(CBLAS_INCLUDE_DIR "cblas.h") + if(CBLAS_INCLUDE_DIR) set(HAVE_LAPACK 1) - ocv_include_directories(${LAPACK_INCLUDE_DIR}) + ocv_include_directories(${LAPACKE_INCLUDE_DIR} ${CBLAS_INCLUDE_DIR}) list(APPEND OPENCV_LINKER_LIBS ${LAPACK_LIBRARIES}) endif() - endif(LAPACK_FOUND) -endif(WITH_LAPACK) + endif() + endif() +endif() # --- TBB --- if(WITH_TBB)