diff --git a/CMakeLists.txt b/CMakeLists.txt index 1439ccdf..7248044c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,10 +44,12 @@ MESSAGE(" Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}") find_package( TBB CONFIG ) # If not found, use FindTBB.cmake -#if ("${TBB_LIBRARIES}" STREQUAL "" OR NOT ${TBB_LIBRARIES}) if ("${TBB_LIBRARIES}" STREQUAL "") MESSAGE("TBB not found in CONFIG, searching with FindTBB.cmake.") find_package( TBB REQUIRED ) + if ("${TBB_LIBRARIES}" STREQUAL "") + MESSAGE(FATAL_ERROR "TBB not found") + endif() else() MESSAGE("TBB found in CONFIG: ${TBB_LIBRARIES}") endif() diff --git a/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp b/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp index 373b4df6..4e525a6b 100644 --- a/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp +++ b/lib/local/LandmarkDetector/src/CCNF_patch_expert.cpp @@ -450,7 +450,8 @@ void CCNF_patch_expert::ResponseOpenBlas(const cv::Mat_ &area_of_interest // Perform matrix multiplication in OpenBLAS (fortran call) float alpha1 = 1.0; float beta1 = 0.0; - sgemm_("N", "N", &normalized_input.cols, &weight_matrix.rows, &weight_matrix.cols, &alpha1, (float*)normalized_input.data, &normalized_input.cols, (float*)weight_matrix.data, &weight_matrix.cols, &beta1, (float*)neuron_resp_full.data, &normalized_input.cols); + char* N = "N"; + sgemm_(N, N, &normalized_input.cols, &weight_matrix.rows, &weight_matrix.cols, &alpha1, (float*)normalized_input.data, &normalized_input.cols, (float*)weight_matrix.data, &weight_matrix.cols, &beta1, (float*)neuron_resp_full.data, &normalized_input.cols); // Above is a faster version of this //cv::Mat_ neuron_resp_full = this->weight_matrix * normalized_input; @@ -494,7 +495,7 @@ void CCNF_patch_expert::ResponseOpenBlas(const cv::Mat_ &area_of_interest // Perform matrix multiplication in OpenBLAS (fortran call) alpha1 = 1.0; beta1 = 0.0; - sgemm_("N", "N", &resp_vec_f.cols, &Sigmas[s_to_use].rows, &Sigmas[s_to_use].cols, &alpha1, (float*)resp_vec_f.data, &resp_vec_f.cols, (float*)Sigmas[s_to_use].data, &Sigmas[s_to_use].cols, &beta1, (float*)out.data, &resp_vec_f.cols); + sgemm_(N, N, &resp_vec_f.cols, &Sigmas[s_to_use].rows, &Sigmas[s_to_use].cols, &alpha1, (float*)resp_vec_f.data, &resp_vec_f.cols, (float*)Sigmas[s_to_use].data, &Sigmas[s_to_use].cols, &beta1, (float*)out.data, &resp_vec_f.cols); // Above is a faster version of this //cv::Mat out = Sigmas[s_to_use] * resp_vec_f; diff --git a/lib/local/LandmarkDetector/src/CEN_patch_expert.cpp b/lib/local/LandmarkDetector/src/CEN_patch_expert.cpp index eeabfac7..cbe07f1d 100644 --- a/lib/local/LandmarkDetector/src/CEN_patch_expert.cpp +++ b/lib/local/LandmarkDetector/src/CEN_patch_expert.cpp @@ -217,7 +217,8 @@ void CEN_patch_expert::Response(const cv::Mat_ &area_of_interest, cv::Mat // Perform matrix multiplication in OpenBLAS (fortran call) float alpha1 = 1.0; float beta1 = 0.0; - sgemm_("N", "N", &resp.cols, &weight.rows, &weight.cols, &alpha1, m1, &resp.cols, m2, &weight.cols, &beta1, m3, &resp.cols); + char* N = "N"; + sgemm_(N, N, &resp.cols, &weight.rows, &weight.cols, &alpha1, m1, &resp.cols, m2, &weight.cols, &beta1, m3, &resp.cols); // The above is a faster version of this, by calling the fortran version directly //cblas_sgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, resp.cols, weight.rows, weight.cols, 1, m1, resp.cols, m2, weight.cols, 0.0, m3, resp.cols); @@ -489,7 +490,8 @@ void CEN_patch_expert::ResponseInternal(cv::Mat_& response) // Perform matrix multiplication in OpenBLAS (fortran call) float alpha1 = 1.0; float beta1 = 0.0; - sgemm_("N", "N", &resp.cols, &weights[layer].rows, &weights[layer].cols, &alpha1, m1, &resp.cols, m2, &weights[layer].cols, &beta1, m3, &resp.cols); + char* N = "N"; + sgemm_(N, N, &resp.cols, &weights[layer].rows, &weights[layer].cols, &alpha1, m1, &resp.cols, m2, &weights[layer].cols, &beta1, m3, &resp.cols); // The above is a faster version of this, by calling the fortran version directly //cblas_sgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, resp.cols, weight.rows, weight.cols, 1, m1, resp.cols, m2, weight.cols, 0.0, m3, resp.cols); diff --git a/lib/local/LandmarkDetector/src/CNN_utils.cpp b/lib/local/LandmarkDetector/src/CNN_utils.cpp index 038fe3fa..29cad081 100644 --- a/lib/local/LandmarkDetector/src/CNN_utils.cpp +++ b/lib/local/LandmarkDetector/src/CNN_utils.cpp @@ -522,7 +522,8 @@ namespace LandmarkDetector float alpha = 1.0f; float beta = 0.0f; // Call fortran directly (faster) - sgemm_("N", "N", &m2_cols, &num_rows, &pre_alloc_im2col.cols, &alpha, m2, &m2_cols, m1, &pre_alloc_im2col.cols, &beta, m3, &m2_cols); + char* N = "N"; + sgemm_(N, N, &m2_cols, &num_rows, &pre_alloc_im2col.cols, &alpha, m2, &m2_cols, m1, &pre_alloc_im2col.cols, &beta, m3, &m2_cols); // Above is equivalent to out = pre_alloc_im2col * weight_matrix; diff --git a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp index 555edde4..2d5fada8 100644 --- a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp +++ b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp @@ -1120,7 +1120,8 @@ float CLNF::NU_RLMS(cv::Vec6f& final_global, cv::Mat_& final_local, const // Perform matrix multiplication in OpenBLAS (fortran call) float alpha1 = 1.0; float beta1 = 1.0; - sgemm_("N", "N", &J.cols, &J_w_t.rows, &J_w_t.cols, &alpha1, (float*)J.data, &J.cols, (float*)J_w_t.data, &J_w_t.cols, &beta1, (float*)Hessian.data, &J.cols); + char* N = "N"; + sgemm_(N, N, &J.cols, &J_w_t.rows, &J_w_t.cols, &alpha1, (float*)J.data, &J.cols, (float*)J_w_t.data, &J_w_t.cols, &beta1, (float*)Hessian.data, &J.cols); // Above is a fast (but ugly) version of // cv::Mat_ Hessian = J_w_t * J + regTerm; diff --git a/lib/local/LandmarkDetector/src/PDM.cpp b/lib/local/LandmarkDetector/src/PDM.cpp index ce4e953f..4d0edb6f 100644 --- a/lib/local/LandmarkDetector/src/PDM.cpp +++ b/lib/local/LandmarkDetector/src/PDM.cpp @@ -146,7 +146,8 @@ void PDM::CalcShape3D(cv::Mat_& out_shape, const cv::Mat_& p_local int p_local_cols = p_local.cols; int princ_comp_rows = princ_comp.rows; int princ_comp_cols = princ_comp.cols; - sgemm_("N", "N", &p_local_cols, &princ_comp_rows, &princ_comp_cols, &alpha1, (float*)p_local.data, &p_local_cols, (float*)princ_comp.data, &princ_comp_cols, &beta1, (float*)out_shape.data, &p_local_cols); + char* N = "N"; + sgemm_(N, N, &p_local_cols, &princ_comp_rows, &princ_comp_cols, &alpha1, (float*)p_local.data, &p_local_cols, (float*)princ_comp.data, &princ_comp_cols, &beta1, (float*)out_shape.data, &p_local_cols); // Above is a fast (but ugly) version of // out_shape = mean_shape + princ_comp * p_local; @@ -645,7 +646,8 @@ void PDM::CalcParams(cv::Vec6f& out_params_global, cv::Mat_& out_params_l // Perform matrix multiplication in OpenBLAS (fortran call) float alpha1 = 1.0; float beta1 = 1.0; - sgemm_("N", "N", &J.cols, &J_w_t.rows, &J_w_t.cols, &alpha1, (float*)J.data, &J.cols, (float*)J_w_t.data, &J_w_t.cols, &beta1, (float*)Hessian.data, &J.cols); + char* N = "N"; + sgemm_(N, N, &J.cols, &J_w_t.rows, &J_w_t.cols, &alpha1, (float*)J.data, &J.cols, (float*)J_w_t.data, &J_w_t.cols, &beta1, (float*)Hessian.data, &J.cols); // Above is a fast (but ugly) version of // cv::Mat_ Hessian2 = J_w_t * J + regularisations;