diff --git a/mobile/.clang-format b/mobile/.clang-format new file mode 100644 index 0000000000000000000000000000000000000000..d59e0885794e037ab02cd1e385cc8c16b93d3a76 --- /dev/null +++ b/mobile/.clang-format @@ -0,0 +1,5 @@ +--- +Language: Cpp +BasedOnStyle: Google +Standard: Cpp11 +... diff --git a/mobile/.clang-tidy b/mobile/.clang-tidy new file mode 100644 index 0000000000000000000000000000000000000000..c788efe69d23e69ee6add3b0be9e09e567494662 --- /dev/null +++ b/mobile/.clang-tidy @@ -0,0 +1,67 @@ +Checks: > + * + -android-* + -bugprone-bool-pointer-implicit-conversion + -cert-env33-c + -cert-dcl50-cpp + -cert-dcl59-cpp + -cppcoreguidelines-* + -fuchsia-* + -google-* + google-default-arguments + google-explicit-constructor + google-runtime-member-string-references + google-runtime-operator + -hicpp-braces-around-statements + -hicpp-named-parameter + -hicpp-no-array-decay + -hicpp-no-assembler + -hicpp-no-malloc + -hicpp-function-size + -hicpp-special-member-functions + -hicpp-vararg + -llvm-* + -objc-* + -readability-else-after-return + -readability-implicit-bool-conversion + -readability-named-parameter + -readability-simplify-boolean-expr + -readability-braces-around-statements + -readability-identifier-naming + -readability-function-size + -readability-redundant-member-init + -misc-bool-pointer-implicit-conversion + -misc-definitions-in-headers + -misc-unused-alias-decls + -misc-unused-parameters + -misc-unused-using-decls + -modernize-use-using + -modernize-use-default-member-init + -clang-diagnostic-* + -clang-analyzer-* +WarningsAsErrors: '*' +HeaderFilterRegex: '' +AnalyzeTemporaryDtors: false +FormatStyle: none +User: allonli +CheckOptions: + - key: google-readability-braces-around-statements.ShortStatementLines + value: '1' + - key: google-readability-function-size.StatementThreshold + value: '800' + - key: google-readability-namespace-comments.ShortNamespaceLines + value: '10' + - key: google-readability-namespace-comments.SpacesBeforeComments + value: '2' + - key: modernize-loop-convert.MaxCopySize + value: '16' + - key: modernize-loop-convert.MinConfidence + value: reasonable + - key: modernize-loop-convert.NamingStyle + value: CamelCase + - key: modernize-pass-by-value.IncludeStyle + value: llvm + - key: modernize-replace-auto-ptr.IncludeStyle + value: llvm + - key: modernize-use-nullptr.NullMacros + value: 'NULL' diff --git a/mobile/.gitignore b/mobile/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..70d0b40927d434c6108a5845faf393b84aa40d34 --- /dev/null +++ b/mobile/.gitignore @@ -0,0 +1,103 @@ +opencl_kernels.cpp +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.lib +*.a + +# Executables +*.exe +*.out +*.app + +.DS_Store + +build/ + +.idea/ + +CMakeCache.txt + +CMakeFiles/ + +Makefile + +cmake_install.cmake + + +*.cbp + +paddle-mobile.cbp + +.idea + +compile_commands.json + +cmake-build-debug/ +cmake-build-release/ + +test/models/ + +test/images/ + +# Emacs intermediate files +*~ + +# CMake building directory +build + +# clion building directories +cmake-build-debug +cmake-build-release + +# ios +tools/libomp.a + +# ios demo +demo/ios/PaddleMobileDemo/PaddleMobileDemo/googlenet_combine/ +demo/ios/PaddleMobileDemo/PaddleMobileDemo/*.jpg +demo/ios/PaddleMobileDemo/PaddleMobileDemo/PaddleMobile/*.a +*.xcuserstate +/tools/quantification/quantify + +# metal +Podfile.lock +metal/Pods/ +SwiftProtobuf.framework +paddle-mobile.xcworkspace +metal/models/ +metal/images/ +*.a +metal/paddle-mobile/paddle-mobile/CPU/libpaddle-mobile.a +*.xcuserdatad/ +*/xcuserdata/ +/venv/ + +metal/paddle-mobile-demo/paddle-mobile-demo/images +metal/paddle-mobile-demo/paddle-mobile-demo/models +metal/paddle-mobile-demo/paddle-mobile-demo/Resources +metal/paddle-mobile-demo/paddle-mobile-demo/Resources/images +metal/paddle-mobile-demo/paddle-mobile-demo/Resources/models +metal/MobileNetDemo/MobileNetDemo/Resources diff --git a/mobile/.pre-commit-config.yaml b/mobile/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d9827afcd0ce2b7b8ce5aacd35f0d5a06fe9af3a --- /dev/null +++ b/mobile/.pre-commit-config.yaml @@ -0,0 +1,69 @@ +repos: +- repo: https://github.com/Lucas-C/pre-commit-hooks.git + sha: v1.0.1 + hooks: + - id: remove-crlf + files: ^(mobile/src/).*\.(md|py|mm|swift|java|c|cc|cxx|cpp|cu|h|hpp|hxx)$ + exclude: ^(lite/) + - id: remove-tabs + files: ^(mobile/test/|mobile/src/).*\.(md|py|mm|swift|java|c|cc|cxx|cpp|cu|h|hpp|hxx)$ + exclude: ^(lite/) + +- repo: https://github.com/pre-commit/pre-commit-hooks + sha: 5bf6c09bfa1297d3692cadd621ef95f1284e33c0 + hooks: + - id: check-added-large-files + exclude: ^(lite/) + - id: check-merge-conflict + exclude: ^(lite/) + - id: check-symlinks + exclude: ^(lite/) + - id: detect-private-key + files: (?!.*tar.gz)^.*$ + exclude: ^(lite/) + - id: end-of-file-fixer + files: ^(mobile/test/|mobile/src/).*\.(md|py|mm|swift|java|c|cc|cxx|cpp|h|hpp|hxx)$ + exclude: ^(lite/) + - id: trailing-whitespace + files: ^(mobile/test/|mobile/src/).*\.(md|py|mm|swift|java|c|cc|cxx|cpp|h|hpp|hxx)$ + exclude: ^(lite/) + +- repo: local + hooks: + - id: copyright + name: copyright + entry: python ./mobile/tools/pre-commit.hooks/copyright.hook + language: system + files: ^(mobile/test/|mobile/src/).*\.(c|cc|cxx|cpp|h|hpp|hxx|py)$ + exclude: (?!.*third_party)^.*$ | (?!.*book)^.*$ | ^(lite/) + +- repo: local + hooks: + - id: clang-format + name: clang-format + description: Format files with ClangFormat. + entry: bash ./mobile/tools/pre-commit.hooks/clang-format.hook -i + language: system + files: ^(mobile/test/|mobile/src/).*\.(c|cc|cxx|cpp|h|hpp|hxx)$ + exclude: ^(lite/) + +- repo: local + hooks: + - id: cpplint + name: cpplint + description: Check C++ code style using cpplint. + entry: bash ./mobile/tools/pre-commit.hooks/cpplint.hook + language: system + files: ^(mobile/test/|mobile/src/).*\.(c|cc|cxx|cpp|h|hpp|hxx)$ + exclude: (?!.*third_party)^.*$ | (?!.*book)^.*$i | *\.pb\.cpp | ^(lite/) + + +# +#- repo: local +# hooks: +# - id: clang-tidy +# name: clang-tidy +# description: Check C++ code style using clang-tidy. +# entry: bash ./tools/pre-commit.hooks/.clang-tidy.hook -i +# language: system +# files: (src).*\.(c|cc|cxx|cpp|h|hpp|hxx)$ diff --git a/mobile/.travis.yml b/mobile/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..20fdddd5a172d63b6b3df3fb2a57265a08ed3732 --- /dev/null +++ b/mobile/.travis.yml @@ -0,0 +1,36 @@ +language: cpp +cache: ccache +sudo: required +dist: trusty + +os: + - linux + +addons: + apt: + packages: + - git + - python + - python-pip + - python2.7-dev + - libc6-i386 + - curl + +compiler: + - clang + +before_install: + - sudo pip install -U virtualenv pre-commit pip + # Download and install recent cmake + +script: + - | + function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; } + - | + timeout 600 .travis/pre-commit-job.sh # 10min timeout + RESULT=$?; if [ $RESULT -eq 0 ] || [ $RESULT -eq 142 ]; then true; else exit 1; fi; + +notifications: + email: + on_success: change + on_failure: always diff --git a/mobile/.travis/pre-commit-job.sh b/mobile/.travis/pre-commit-job.sh new file mode 100755 index 0000000000000000000000000000000000000000..a0ae98dddd27a7f24467ce2ce441aba9e4ffe156 --- /dev/null +++ b/mobile/.travis/pre-commit-job.sh @@ -0,0 +1,21 @@ +#!/bin/bash +function abort(){ + echo "Your change doesn't follow Paddle-Moible's code style" 1>&2 + echo "Please use pre-commit to auto-format your code." 1>&2 + exit 1 +} + +trap 'abort' 0 +set -e +cd `dirname $0` +cd .. +export PATH=/usr/bin:$PATH +pre-commit install + +if ! pre-commit run -a ; then + ls -lh + git diff --exit-code + exit 1 +fi + +trap : 0 diff --git a/mobile/src/framework/cl/cl_engine.h b/mobile/src/framework/cl/cl_engine.h index 0c18cd5f1a4628bc6d157bc664af175f2bdd2be4..439209d0e8590429ce961b894af6735271099112 100644 --- a/mobile/src/framework/cl/cl_engine.h +++ b/mobile/src/framework/cl/cl_engine.h @@ -96,6 +96,21 @@ class CLEngine { return std::move(program_ptr); } + std::unique_ptr<_cl_program, CLProgramDeleter> CreateProgramWithSource( + cl_context context, const char *source) { + size_t sourceSize[] = {strlen(source)}; + cl_program p = + clCreateProgramWithSource(context, 1, &source, sourceSize, &status_); + + DLOG << " cl kernel from source"; + DLOG << " source size: " << sourceSize[0]; + CL_CHECK_ERRORS(status_); + + std::unique_ptr<_cl_program, CLProgramDeleter> program_ptr(p); + + return std::move(program_ptr); + } + std::unique_ptr<_cl_event, CLEventDeleter> CreateEvent(cl_context context) { cl_event event = clCreateUserEvent(context, &status_); std::unique_ptr<_cl_event, CLEventDeleter> event_ptr(event); diff --git a/mobile/src/framework/cl/cl_scope.h b/mobile/src/framework/cl/cl_scope.h index e45baa525c5738d255a8296aaea19cd082734279..5f15a1f6d17f81dd18c5acdd923b8ad5c71e644c 100644 --- a/mobile/src/framework/cl/cl_scope.h +++ b/mobile/src/framework/cl/cl_scope.h @@ -14,9 +14,11 @@ limitations under the License. */ #pragma once +#include #include #include #include +#include #include "CL/cl.h" #include "framework/cl/cl_deleter.h" @@ -24,6 +26,10 @@ limitations under the License. */ #include "framework/cl/cl_tool.h" namespace paddle_mobile { + +extern const std::map> opencl_kernels; +extern const std::vector need_conv_header_kernels; + namespace framework { class CLScope { @@ -62,15 +68,35 @@ class CLScope { return it->second.get(); } - auto program = CLEngine::Instance()->CreateProgramWith( - context_, - CLEngine::Instance()->GetCLPath() + "/cl_kernel/" + file_name); - - DLOG << " --- begin build program -> " << program_key << " --- "; - CLEngine::Instance()->BuildProgram(program.get(), options); - DLOG << " --- end build program -> " << program_key << " --- "; - - programs_[program_key] = std::move(program); + if (opencl_kernels.find(file_name) != opencl_kernels.end()) { + auto it = opencl_kernels.find(file_name); + std::string source(it->second.begin(), it->second.end()); + if (std::find(need_conv_header_kernels.begin(), + need_conv_header_kernels.end(), + file_name) != need_conv_header_kernels.end()) { + auto it = opencl_kernels.find("conv_kernel.inc.cl"); + std::string header(it->second.begin(), it->second.end()); + source = header + source; + } + auto program = CLEngine::Instance()->CreateProgramWithSource( + context_, source.c_str()); + + DLOG << " --- begin build program -> " << program_key << " --- "; + CLEngine::Instance()->BuildProgram(program.get(), options); + DLOG << " --- end build program -> " << program_key << " --- "; + + programs_[program_key] = std::move(program); + } else { + auto program = CLEngine::Instance()->CreateProgramWith( + context_, + CLEngine::Instance()->GetCLPath() + "/cl_kernel/" + file_name); + + DLOG << " --- begin build program -> " << program_key << " --- "; + CLEngine::Instance()->BuildProgram(program.get(), options); + DLOG << " --- end build program -> " << program_key << " --- "; + + programs_[program_key] = std::move(program); + } return programs_[program_key].get(); } diff --git a/mobile/src/io/paddle_mobile_wrap.h b/mobile/src/io/paddle_mobile_wrap.h index 72d85b8a5727b54bdcea12ddb061e8b1675cec4d..5048b1234e318dfd7606114989587ef2ffbc4244 100644 --- a/mobile/src/io/paddle_mobile_wrap.h +++ b/mobile/src/io/paddle_mobile_wrap.h @@ -16,9 +16,9 @@ limitations under the License. */ #include #include +#include #include #include -#include #include #include diff --git a/mobile/src/operators/kernel/arm/conditional_block_kernel.cpp b/mobile/src/operators/kernel/arm/conditional_block_kernel.cpp index df98f74b8f5322c2d492b4c349e499a0ac82014c..a5530559d1a3a90996eb1a4ed94b31b85edad521 100644 --- a/mobile/src/operators/kernel/arm/conditional_block_kernel.cpp +++ b/mobile/src/operators/kernel/arm/conditional_block_kernel.cpp @@ -14,10 +14,10 @@ limitations under the License. */ #ifdef CONDITIONAL_BLOCK_OP -#include #include "operators/kernel/conditional_block_kernel.h" #include #include +#include #include "framework/data_type.h" namespace paddle_mobile { diff --git a/mobile/src/operators/kernel/cl/gen_code.py b/mobile/src/operators/kernel/cl/gen_code.py new file mode 100644 index 0000000000000000000000000000000000000000..14608c95fc0924ea95eea1b25493262f81c45505 --- /dev/null +++ b/mobile/src/operators/kernel/cl/gen_code.py @@ -0,0 +1,103 @@ +# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import re +import os +import sys + +source = """ +#pragma +#ifdef PADDLE_MOBILE_CL +#include +#include +#include +namespace paddle_mobile { + extern const std::map> opencl_kernels = { +%s + }; + extern const std::vector need_conv_header_kernels = { + %s + }; +} +#endif +""" + +def string_to_hex(str): + hex_list = [] + for i in range(len(code_str)): + hex_ = hex(ord(code_str[i])) + hex_list.append(hex_) + return hex_list + +infile = open("cl_kernel/cl_common.h", "r") +common_content = infile.read() +infile.close() +common_content = re.sub(r"/\*[^*]*\*/", "", common_content, flags=re.DOTALL) +lines = common_content.split("\n") +new_lines = [] +for i in range(len(lines)): + line = lines[i] + line = line.strip() + if line == "": + continue + if line.startswith("//"): + continue + line = re.sub(r"//.*$", "", line) + new_lines.append(line) +common_content = "\n".join(new_lines) + +need_conv_header_kernels = [] + +cores = "" +filenames = os.listdir("cl_kernel") +file_count = len(filenames) +for i in range(file_count): + filename = filenames[i] + infile = open("cl_kernel/" + filename, "r") + new_lines = [] + content = infile.read() + content = re.sub(r"/\*[^*]*\*/", "", content, flags=re.DOTALL) + infile.close() + lines = content.split("\n") + for i in range(len(lines)): + line = lines[i] + line = line.strip() + if line == "": + continue + if line.startswith("//"): + continue + line = re.sub(r"//.*$", "", line) + if "cl_common.h" in line: + line = common_content + elif "conv_kernel.inc.cl" in line: + need_conv_header_kernels.append("\"%s\"" % filename) + continue + new_lines.append(line) + content = "\n".join(new_lines) + if content == "": + content = " " + hexes = [] + for char in content: + hexes.append(hex(ord(char))) + core = " {\"%s\", {" % filename + for item in hexes: + core += str(item) + ", " + core = core[: -2] + core += "}}" + if i != file_count - 1: + core += ",\n" + cores += core + +source = source % (cores, ",".join(need_conv_header_kernels)) +print(source) diff --git a/mobile/test/CMakeLists.txt b/mobile/test/CMakeLists.txt index 36293ab8846741fd7e5c4de66fe6537eca277270..1b6675f43eed3d97213aef198e33db622676227a 100644 --- a/mobile/test/CMakeLists.txt +++ b/mobile/test/CMakeLists.txt @@ -1,6 +1,7 @@ set(dir ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${dir}/build") set(FOUND_MATCH OFF) +set(ENABLE_ALL_TEST ON) set(CON -1) @@ -197,334 +198,340 @@ if (CON GREATER -1) set(FOUND_MATCH ON) endif () -if (NOT FOUND_MATCH) - # gen test - ADD_EXECUTABLE(test-resnet net/test_resnet.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-resnet paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-squeezenet net/test_squeezenet.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-squeezenet paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-yolo net/test_yolo.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-yolo paddle-mobile) - - # gen test - ADD_EXECUTABLE(test_yolo_combined net/test_yolo_combined.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test_yolo_combined paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-op-in-net net/test_op_in_net.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-op-in-net paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-googlenet net/test_googlenet.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-googlenet paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-googlenet-quali net/test_googlenet_quali.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-googlenet-quali paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-conv-op operators/test_conv_op.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-conv-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-mul-op operators/test_mul_op.cpp test_helper.h test_include.h) - target_link_libraries(test-mul-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-elementwiseadd-op operators/test_elementwise_add_op.cpp test_helper.h test_include.h) - target_link_libraries(test-elementwiseadd-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-elementwisesub-op operators/test_elementwise_sub_op.cpp test_helper.h test_include.h) - target_link_libraries(test-elementwisesub-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-im2sequence-op operators/test_im2sequence_op.cpp test_helper.h test_include.h) - target_link_libraries(test-im2sequence-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-concat-op operators/test_concat_op.cpp test_helper.h test_include.h) - target_link_libraries(test-concat-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-lrn-op operators/test_lrn_op.cpp test_helper.h test_include.h) - target_link_libraries(test-lrn-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-batchnorm-op operators/test_batchnorm_op.cpp test_helper.h test_include.h) - target_link_libraries(test-batchnorm-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-priorbox-op operators/test_prior_box_op.cpp test_helper.h test_include.h) - target_link_libraries(test-priorbox-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-boxcoder-op operators/test_box_coder_op.cpp test_helper.h test_include.h) - target_link_libraries(test-boxcoder-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-transpose-op operators/test_transpose_op.cpp test_helper.h test_include.h) - target_link_libraries(test-transpose-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-transpose2-op operators/test_transpose2_op.cpp test_helper.h test_include.h) - target_link_libraries(test-transpose2-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-multiclassnms-op operators/test_multiclass_nms_op.cpp test_helper.h test_include.h) - target_link_libraries(test-multiclassnms-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-polygon-box-transform-op operators/test_polygon_box_transform_op.cpp test_helper.h test_include.h) - target_link_libraries(test-polygon-box-transform-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-fill-constant-op operators/test_fill_constant_op.cpp test_helper.h test_include.h) - target_link_libraries(test-fill-constant-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-reshape-op operators/test_reshape_op.cpp test_helper.h test_include.h) - target_link_libraries(test-reshape-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-reshape2-op operators/test_reshape2_op.cpp test_helper.h test_include.h) - target_link_libraries(test-reshape2-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-relu-op operators/test_relu_op.cpp test_helper.h test_include.h) - target_link_libraries(test-relu-op paddle-mobile) - - ADD_EXECUTABLE(test-relu6-op operators/test_relu6_op.cpp test_helper.h test_include.h) - target_link_libraries(test-relu6-op paddle-mobile) - - ADD_EXECUTABLE(test-tanh-op operators/test_tanh_op.cpp test_helper.h test_include.h) - target_link_libraries(test-tanh-op paddle-mobile) - - ADD_EXECUTABLE(test-log-op operators/test_log_op.cpp test_helper.h test_include.h) - target_link_libraries(test-log-op paddle-mobile) - - ADD_EXECUTABLE(test-topk-op operators/test_topk_op.cpp test_helper.h test_include.h) - target_link_libraries(test-topk-op paddle-mobile) - - ADD_EXECUTABLE(test-cast-op operators/test_cast_op.cpp test_helper.h test_include.h) - target_link_libraries(test-cast-op paddle-mobile) - - ADD_EXECUTABLE(test-less-than-op operators/test_less_than_op.cpp test_helper.h test_include.h) - target_link_libraries(test-less-than-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-fc-op operators/test_fusion_fc_op.cpp test_helper.h test_include.h) - target_link_libraries(test-fc-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-sum-op operators/test_sum_op.cpp test_helper.h test_include.h) - target_link_libraries(test-sum-op paddle-mobile) - - # test quantize op - ADD_EXECUTABLE(test-quantize-op operators/test_quantize_op.cpp test_helper.h test_include.h) - target_link_libraries(test-quantize-op paddle-mobile) - - # test dequantize op - ADD_EXECUTABLE(test-dequantize-op operators/test_dequantize_op.cpp test_helper.h test_include.h) - target_link_libraries(test-dequantize-op paddle-mobile) - - # gen test log - ADD_EXECUTABLE(test-log common/test_log.cpp) - target_link_libraries(test-log paddle-mobile) - - # gen test log - ADD_EXECUTABLE(test-load framework/test_load.cpp) - target_link_libraries(test-load paddle-mobile) - - # gen test log - ADD_EXECUTABLE(test-loadmemory framework/test_load_memory.cpp) - target_link_libraries(test-loadmemory paddle-mobile) - - # gen test log - ADD_EXECUTABLE(test-loadmemory-inference framework/test_load_memory_inference_api.cpp) - target_link_libraries(test-loadmemory-inference paddle-mobile) - - ADD_EXECUTABLE(test-inference-api framework/test_inference_api.cpp) - target_link_libraries(test-inference-api paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-optimize framework/test_optimize.cpp) - target_link_libraries(test-optimize paddle-mobile) - - #gen test - ADD_EXECUTABLE(test-pool-op operators/test_pool_op.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-pool-op paddle-mobile) - - #gen test - ADD_EXECUTABLE(test-softmax-op operators/test_softmax_op.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-softmax-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-gemm-accuracy common/test_gemm_accuracy.cpp) - target_link_libraries(test-gemm-accuracy paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-gemm-int8-accuracy common/test_gemm_int8_accuracy.cpp) - target_link_libraries(test-gemm-int8-accuracy paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-gemm-perf common/test_gemm_perf.cpp) - target_link_libraries(test-gemm-perf paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-enforce common/test_enforce.cpp) - target_link_libraries(test-enforce paddle-mobile) - - # gen test - test if openmp works - ADD_EXECUTABLE(test-openmp common/test_openmp.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-openmp paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-mobilenetssd net/test_mobilenet+ssd.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-mobilenetssd paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-mobilenet-combine net/test_mobilenet_combine.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-mobilenet-combine paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-genet net/test_genet_combine.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-genet paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-sigmoid-op operators/test_sigmoid_op.cpp test_include.h) - target_link_libraries(test-sigmoid-op paddle-mobile) - - # gen test log - ADD_EXECUTABLE(test-leakyrelu operators/test_leaky_relu_op.cpp) - target_link_libraries(test-leakyrelu paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-depthwise-conv-op operators/test_depthwise_conv_op.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-depthwise-conv-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-mobilenet net/test_mobilenet.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-mobilenet paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-conv-add-relu-op operators/test_conv_add_relu_op.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-conv-add-relu-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-conv-add-bn-relu-op operators/test_fusion_conv_add_bn_relu_op.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-conv-add-bn-relu-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-nlp net/test_nlp.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-nlp paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-gru-op operators/test_gru_op.cpp test_helper.h test_include.h) - target_link_libraries(test-gru-op paddle-mobile) - - # gen test - - ADD_EXECUTABLE(test-inceptionv4 net/test_inceptionv4.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-inceptionv4 paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-alexnet net/test_alexnet.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-alexnet paddle-mobile) - - ADD_EXECUTABLE(test-googlenetv1 net/test_googlenetv1_combine.cpp test_helper.h test_include.h) - target_link_libraries(test-googlenetv1 paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-fssd net/test_mobilenet_025_fssd.cpp test_helper.h test_include.h) - target_link_libraries(test-fssd paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-mobilenetgpu net/test_mobilenet_GPU.cpp test_helper.h test_include.h) - target_link_libraries(test-mobilenetgpu paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-yologpu net/test_yologpu.cpp test_helper.h test_include.h executor_for_test.h) - target_link_libraries(test-yologpu paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-multi-process net/test_multi_inference_predict.cpp test_helper.h test_include.h) - target_link_libraries(test-multi-process paddle-mobile) - - # gen test benchmark - ADD_EXECUTABLE(test-benchmark net/test_benchmark.cpp) - target_link_libraries(test-benchmark paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-eng net/test_eng.cpp test_helper.h test_include.h) - target_link_libraries(test-eng paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-super net/test_super.cpp test_helper.h test_include.h) - target_link_libraries(test-super paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-ocr net/test_ocr.cpp test_helper.h test_include.h) - target_link_libraries(test-ocr paddle-mobile) - - ADD_EXECUTABLE(test-gesture net/test_gesture.cpp test_helper.h test_include.h) - target_link_libraries(test-gesture paddle-mobile) - - - ADD_EXECUTABLE(test-sequence-expand-op operators/test_sequence_expand_op.cpp test_helper.h test_include.h) - target_link_libraries(test-sequence-expand-op paddle-mobile) - - ADD_EXECUTABLE(test-sequence-pool-op operators/test_sequence_pool_op.cpp test_helper.h test_include.h) - target_link_libraries(test-sequence-pool-op paddle-mobile) - - ADD_EXECUTABLE(test-sequence-softmax-op operators/test_sequence_softmax_op.cpp test_helper.h test_include.h) - target_link_libraries(test-sequence-softmax-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-vgg16ssd net/test_vgg16ssd.cpp test_helper.h test_include.h) - target_link_libraries(test-vgg16ssd paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-logical-and-op operators/test_logical_and_op.cpp test_helper.h test_include.h) - target_link_libraries(test-logical-and-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-logical-or-op operators/test_logical_or_op.cpp test_helper.h test_include.h) - target_link_libraries(test-logical-or-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-logical-not-op operators/test_logical_not_op.cpp test_helper.h test_include.h) - target_link_libraries(test-logical-not-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-logical-xor-op operators/test_logical_xor_op.cpp test_helper.h test_include.h) - target_link_libraries(test-logical-xor-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-increment-op operators/test_increment_op.cpp test_helper.h test_include.h) - target_link_libraries(test-increment-op paddle-mobile) - - # gen test - ADD_EXECUTABLE(test-is-empty-op operators/test_is_empty_op.cpp test_helper.h test_include.h) - target_link_libraries(test-is-empty-op paddle-mobile) - - ADD_EXECUTABLE(test-conv-bn-relu-op operators/test_conv_bn_relu_op.cpp test_helper.h test_include.h) - target_link_libraries(test-conv-bn-relu-op paddle-mobile) - - ADD_EXECUTABLE(test-dwconv-bn-relu-op operators/test_dwconv_bn_relu_op.cpp test_helper.h test_include.h) - target_link_libraries(test-dwconv-bn-relu-op paddle-mobile) - - ADD_EXECUTABLE(test-conv-gpu operators/test_conv_gpu.cpp test_helper.h test_include.h) - target_link_libraries(test-conv-gpu paddle-mobile) - - ADD_EXECUTABLE(test-net-benchmark net/test_net_benchmark.cpp test_helper.h test_include.h) - target_link_libraries(test-net-benchmark paddle-mobile) - +if (ENABLE_ALL_TEST) + if (NOT FOUND_MATCH) + # gen test + ADD_EXECUTABLE(test-resnet net/test_resnet.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-resnet paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-squeezenet net/test_squeezenet.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-squeezenet paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-yolo net/test_yolo.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-yolo paddle-mobile) + + # gen test + ADD_EXECUTABLE(test_yolo_combined net/test_yolo_combined.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test_yolo_combined paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-op-in-net net/test_op_in_net.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-op-in-net paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-googlenet net/test_googlenet.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-googlenet paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-googlenet-quali net/test_googlenet_quali.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-googlenet-quali paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-conv-op operators/test_conv_op.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-conv-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-mul-op operators/test_mul_op.cpp test_helper.h test_include.h) + target_link_libraries(test-mul-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-elementwiseadd-op operators/test_elementwise_add_op.cpp test_helper.h test_include.h) + target_link_libraries(test-elementwiseadd-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-elementwisesub-op operators/test_elementwise_sub_op.cpp test_helper.h test_include.h) + target_link_libraries(test-elementwisesub-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-im2sequence-op operators/test_im2sequence_op.cpp test_helper.h test_include.h) + target_link_libraries(test-im2sequence-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-concat-op operators/test_concat_op.cpp test_helper.h test_include.h) + target_link_libraries(test-concat-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-lrn-op operators/test_lrn_op.cpp test_helper.h test_include.h) + target_link_libraries(test-lrn-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-batchnorm-op operators/test_batchnorm_op.cpp test_helper.h test_include.h) + target_link_libraries(test-batchnorm-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-priorbox-op operators/test_prior_box_op.cpp test_helper.h test_include.h) + target_link_libraries(test-priorbox-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-boxcoder-op operators/test_box_coder_op.cpp test_helper.h test_include.h) + target_link_libraries(test-boxcoder-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-transpose-op operators/test_transpose_op.cpp test_helper.h test_include.h) + target_link_libraries(test-transpose-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-transpose2-op operators/test_transpose2_op.cpp test_helper.h test_include.h) + target_link_libraries(test-transpose2-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-multiclassnms-op operators/test_multiclass_nms_op.cpp test_helper.h test_include.h) + target_link_libraries(test-multiclassnms-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-polygon-box-transform-op operators/test_polygon_box_transform_op.cpp test_helper.h test_include.h) + target_link_libraries(test-polygon-box-transform-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-fill-constant-op operators/test_fill_constant_op.cpp test_helper.h test_include.h) + target_link_libraries(test-fill-constant-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-reshape-op operators/test_reshape_op.cpp test_helper.h test_include.h) + target_link_libraries(test-reshape-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-reshape2-op operators/test_reshape2_op.cpp test_helper.h test_include.h) + target_link_libraries(test-reshape2-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-relu-op operators/test_relu_op.cpp test_helper.h test_include.h) + target_link_libraries(test-relu-op paddle-mobile) + + ADD_EXECUTABLE(test-relu6-op operators/test_relu6_op.cpp test_helper.h test_include.h) + target_link_libraries(test-relu6-op paddle-mobile) + + ADD_EXECUTABLE(test-tanh-op operators/test_tanh_op.cpp test_helper.h test_include.h) + target_link_libraries(test-tanh-op paddle-mobile) + + ADD_EXECUTABLE(test-log-op operators/test_log_op.cpp test_helper.h test_include.h) + target_link_libraries(test-log-op paddle-mobile) + + ADD_EXECUTABLE(test-topk-op operators/test_topk_op.cpp test_helper.h test_include.h) + target_link_libraries(test-topk-op paddle-mobile) + + ADD_EXECUTABLE(test-cast-op operators/test_cast_op.cpp test_helper.h test_include.h) + target_link_libraries(test-cast-op paddle-mobile) + + ADD_EXECUTABLE(test-less-than-op operators/test_less_than_op.cpp test_helper.h test_include.h) + target_link_libraries(test-less-than-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-fc-op operators/test_fusion_fc_op.cpp test_helper.h test_include.h) + target_link_libraries(test-fc-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-sum-op operators/test_sum_op.cpp test_helper.h test_include.h) + target_link_libraries(test-sum-op paddle-mobile) + + # test quantize op + ADD_EXECUTABLE(test-quantize-op operators/test_quantize_op.cpp test_helper.h test_include.h) + target_link_libraries(test-quantize-op paddle-mobile) + + # test dequantize op + ADD_EXECUTABLE(test-dequantize-op operators/test_dequantize_op.cpp test_helper.h test_include.h) + target_link_libraries(test-dequantize-op paddle-mobile) + + # gen test log + ADD_EXECUTABLE(test-log common/test_log.cpp) + target_link_libraries(test-log paddle-mobile) + + # gen test log + ADD_EXECUTABLE(test-load framework/test_load.cpp) + target_link_libraries(test-load paddle-mobile) + + # gen test log + ADD_EXECUTABLE(test-loadmemory framework/test_load_memory.cpp) + target_link_libraries(test-loadmemory paddle-mobile) + + # gen test log + ADD_EXECUTABLE(test-loadmemory-inference framework/test_load_memory_inference_api.cpp) + target_link_libraries(test-loadmemory-inference paddle-mobile) + + ADD_EXECUTABLE(test-inference-api framework/test_inference_api.cpp) + target_link_libraries(test-inference-api paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-optimize framework/test_optimize.cpp) + target_link_libraries(test-optimize paddle-mobile) + + #gen test + ADD_EXECUTABLE(test-pool-op operators/test_pool_op.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-pool-op paddle-mobile) + + #gen test + ADD_EXECUTABLE(test-softmax-op operators/test_softmax_op.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-softmax-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-gemm-accuracy common/test_gemm_accuracy.cpp) + target_link_libraries(test-gemm-accuracy paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-gemm-int8-accuracy common/test_gemm_int8_accuracy.cpp) + target_link_libraries(test-gemm-int8-accuracy paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-gemm-perf common/test_gemm_perf.cpp) + target_link_libraries(test-gemm-perf paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-enforce common/test_enforce.cpp) + target_link_libraries(test-enforce paddle-mobile) + + # gen test - test if openmp works + ADD_EXECUTABLE(test-openmp common/test_openmp.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-openmp paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-mobilenetssd net/test_mobilenet+ssd.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-mobilenetssd paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-mobilenet-combine net/test_mobilenet_combine.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-mobilenet-combine paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-genet net/test_genet_combine.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-genet paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-sigmoid-op operators/test_sigmoid_op.cpp test_include.h) + target_link_libraries(test-sigmoid-op paddle-mobile) + + # gen test log + ADD_EXECUTABLE(test-leakyrelu operators/test_leaky_relu_op.cpp) + target_link_libraries(test-leakyrelu paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-depthwise-conv-op operators/test_depthwise_conv_op.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-depthwise-conv-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-mobilenet net/test_mobilenet.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-mobilenet paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-conv-add-relu-op operators/test_conv_add_relu_op.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-conv-add-relu-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-conv-add-bn-relu-op operators/test_fusion_conv_add_bn_relu_op.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-conv-add-bn-relu-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-nlp net/test_nlp.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-nlp paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-gru-op operators/test_gru_op.cpp test_helper.h test_include.h) + target_link_libraries(test-gru-op paddle-mobile) + + # gen test + + ADD_EXECUTABLE(test-inceptionv4 net/test_inceptionv4.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-inceptionv4 paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-alexnet net/test_alexnet.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-alexnet paddle-mobile) + + ADD_EXECUTABLE(test-googlenetv1 net/test_googlenetv1_combine.cpp test_helper.h test_include.h) + target_link_libraries(test-googlenetv1 paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-fssd net/test_mobilenet_025_fssd.cpp test_helper.h test_include.h) + target_link_libraries(test-fssd paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-mobilenetgpu net/test_mobilenet_GPU.cpp test_helper.h test_include.h) + target_link_libraries(test-mobilenetgpu paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-yologpu net/test_yologpu.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-yologpu paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-multi-process net/test_multi_inference_predict.cpp test_helper.h test_include.h) + target_link_libraries(test-multi-process paddle-mobile) + + # gen test benchmark + ADD_EXECUTABLE(test-benchmark net/test_benchmark.cpp) + target_link_libraries(test-benchmark paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-eng net/test_eng.cpp test_helper.h test_include.h) + target_link_libraries(test-eng paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-super net/test_super.cpp test_helper.h test_include.h) + target_link_libraries(test-super paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-ocr net/test_ocr.cpp test_helper.h test_include.h) + target_link_libraries(test-ocr paddle-mobile) + + ADD_EXECUTABLE(test-gesture net/test_gesture.cpp test_helper.h test_include.h) + target_link_libraries(test-gesture paddle-mobile) + + + ADD_EXECUTABLE(test-sequence-expand-op operators/test_sequence_expand_op.cpp test_helper.h test_include.h) + target_link_libraries(test-sequence-expand-op paddle-mobile) + + ADD_EXECUTABLE(test-sequence-pool-op operators/test_sequence_pool_op.cpp test_helper.h test_include.h) + target_link_libraries(test-sequence-pool-op paddle-mobile) + + ADD_EXECUTABLE(test-sequence-softmax-op operators/test_sequence_softmax_op.cpp test_helper.h test_include.h) + target_link_libraries(test-sequence-softmax-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-vgg16ssd net/test_vgg16ssd.cpp test_helper.h test_include.h) + target_link_libraries(test-vgg16ssd paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-logical-and-op operators/test_logical_and_op.cpp test_helper.h test_include.h) + target_link_libraries(test-logical-and-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-logical-or-op operators/test_logical_or_op.cpp test_helper.h test_include.h) + target_link_libraries(test-logical-or-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-logical-not-op operators/test_logical_not_op.cpp test_helper.h test_include.h) + target_link_libraries(test-logical-not-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-logical-xor-op operators/test_logical_xor_op.cpp test_helper.h test_include.h) + target_link_libraries(test-logical-xor-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-increment-op operators/test_increment_op.cpp test_helper.h test_include.h) + target_link_libraries(test-increment-op paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-is-empty-op operators/test_is_empty_op.cpp test_helper.h test_include.h) + target_link_libraries(test-is-empty-op paddle-mobile) + + ADD_EXECUTABLE(test-conv-bn-relu-op operators/test_conv_bn_relu_op.cpp test_helper.h test_include.h) + target_link_libraries(test-conv-bn-relu-op paddle-mobile) + + ADD_EXECUTABLE(test-dwconv-bn-relu-op operators/test_dwconv_bn_relu_op.cpp test_helper.h test_include.h) + target_link_libraries(test-dwconv-bn-relu-op paddle-mobile) + + ADD_EXECUTABLE(test-conv-gpu operators/test_conv_gpu.cpp test_helper.h test_include.h) + target_link_libraries(test-conv-gpu paddle-mobile) + + ADD_EXECUTABLE(test-net-benchmark net/test_net_benchmark.cpp test_helper.h test_include.h) + target_link_libraries(test-net-benchmark paddle-mobile) + + # gen test + ADD_EXECUTABLE(test-net net/test_net.cpp test_helper.h test_include.h executor_for_test.h) + target_link_libraries(test-net paddle-mobile) + endif () +else() # gen test ADD_EXECUTABLE(test-net net/test_net.cpp test_helper.h test_include.h executor_for_test.h) target_link_libraries(test-net paddle-mobile) -endif () +endif() diff --git a/mobile/tools/build.sh b/mobile/tools/build.sh index f7ae755a818fd605de70739f088a4b49530e22a8..f0e192805b1709f9ee721e79758f650ec18c16df 100755 --- a/mobile/tools/build.sh +++ b/mobile/tools/build.sh @@ -2,6 +2,15 @@ NETS="" declare -a supportedNets=("googlenet" "mobilenet" "yolo" "squeezenet" "resnet" "mobilenetssd" "nlp" "mobilenetfssd" "genet" "super" "op") +# merge cl to so +merge_cl_to_so=1 +rm ../src/operators/kernel/cl/opencl_kernels.cpp +if [ $merge_cl_to_so == 1 ]; then + cd ../src/operators/kernel/cl + python gen_code.py > opencl_kernels.cpp + cd - +fi + build_for_mac() { if [ ! `which brew` ]; then echo "building failed! homebrew not found, please install homebrew." diff --git a/mobile/tools/pre-commit.hooks/clang-format.hook b/mobile/tools/pre-commit.hooks/clang-format.hook index 92377d2dd6b53c69aaff41e4ea204b80fef31671..ffba8744f4b96c53907f7848592418e4356bf6bb 100644 --- a/mobile/tools/pre-commit.hooks/clang-format.hook +++ b/mobile/tools/pre-commit.hooks/clang-format.hook @@ -1,5 +1,5 @@ #!/bin/bash -set -e +# set -e readonly VERSION="5.0" diff --git a/mobile/tools/python/fluidtools/run.py b/mobile/tools/python/fluidtools/run.py index fc65f19a1dfc0e3fce2c55f487ba901cd9132242..2bf704fb8d119b657ba114fc90c01f92020bc7ce 100644 --- a/mobile/tools/python/fluidtools/run.py +++ b/mobile/tools/python/fluidtools/run.py @@ -535,6 +535,7 @@ def main(): push(checked_model_path) push(feed_path + "/" + last_feed_file_name, "input.txt") push(mobile_src_root + "/build/release/arm-v7a/build/libpaddle-mobile.so") + push(mobile_src_root + "/build/release/arm-v7a/build/cl_kernel") push(mobile_src_root + "/test/build/test-net") last_feed_var_shape = get_feed_var_shape(last_feed_var_name) args = str(len(last_feed_var_shape))