From a50a8beac4f34907658e59bbfd62c646cb4dda5c Mon Sep 17 00:00:00 2001 From: Yuan Shuai Date: Thu, 19 Mar 2020 10:39:42 +0800 Subject: [PATCH] [LITE][CMAKE] Armv7 gcc opencl compile (#3200) * [LITE][OPENCL] Change fp32 fc to fp16's. test=develop * fix act in conv3x3opt opencl kernel. test=develop * [LITE][CMAKE] fix cmake for opencl tiny_pubish compile. test=develop --- cmake/cross_compiling/postproject.cmake | 10 ++++------ lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cmake/cross_compiling/postproject.cmake b/cmake/cross_compiling/postproject.cmake index 82dd60f4b4..3db715ba74 100644 --- a/cmake/cross_compiling/postproject.cmake +++ b/cmake/cross_compiling/postproject.cmake @@ -57,22 +57,20 @@ function(check_linker_flag) endforeach() set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} PARENT_SCOPE) endfunction() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") if (LITE_ON_TINY_PUBLISH) if((NOT LITE_WITH_PYTHON)) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") endif() + if(LITE_WITH_OPENCL AND (ARM_TARGET_LANG STREQUAL "clang")) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") + endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -Ofast -Os -fomit-frame-pointer -fno-asynchronous-unwind-tables -fno-unwind-tables") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -ffunction-sections") check_linker_flag(-Wl,--gc-sections) endif() -if(LITE_WITH_OPENCL) - if(ARM_TARGET_LANG STREQUAL "clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") - endif() -endif() - if(LITE_WITH_OPENMP) find_package(OpenMP REQUIRED) if(OPENMP_FOUND OR OpenMP_CXX_FOUND) diff --git a/lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc b/lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc index 3eaf63e7f9..9f836c57a8 100644 --- a/lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc +++ b/lite/demo/cxx/mobile_light/mobilenetv1_light_api.cc @@ -101,7 +101,7 @@ void RunModel(std::string model_dir, // 5. Get output std::cout << "\n====== output summary ====== " << std::endl; size_t output_tensor_num = predictor->GetOutputNames().size(); - std::cout << "output tesnor num:" << output_tensor_num << std::endl; + std::cout << "output tensor num:" << output_tensor_num << std::endl; for (size_t tidx = 0; tidx < output_tensor_num; ++tidx) { std::unique_ptr output_tensor = -- GitLab