diff --git a/mobile/src/common/log.h b/mobile/src/common/log.h index dde50b61707192b9987da6aa56c2117a2bd70c06..69654c505d234709d6c3119be346cefaf82c04a9 100644 --- a/mobile/src/common/log.h +++ b/mobile/src/common/log.h @@ -33,28 +33,49 @@ namespace paddle_mobile { static const char *ANDROID_LOG_TAG = "paddle_mobile LOG built on " __DATE__ " " __TIME__; - +#ifdef PADDLE_ENABLE_COLORABLE_LOG +#define PADDLE_RED "\033[1;31;40m" +#define PADDLE_GREEN "\033[1;32;40m" +#define PADDLE_YELLOW "\033[1;33;40m" +#define PADDLE_LIGHT_RED "\033[1;35;40m" +#define PADDLE_BLUE "\033[1;34;40m" +#define PADDLE_WHITE "\033[1;37;40m" +#define PADDLE_CONON "\033[0m" +#else +#define PADDLE_RED "" +#define PADDLE_GREEN "" +#define PADDLE_YELLOW "" +#define PADDLE_LIGHT_RED "" +#define PADDLE_BLUE "" +#define PADDLE_WHITE "" +#define PADDLE_CONON "" +#endif #define ANDROIDLOGI(...) \ __android_log_print(ANDROID_LOG_INFO, ANDROID_LOG_TAG, __VA_ARGS__); \ - fprintf(stderr, "%s\n", __VA_ARGS__); \ + fprintf(stderr, PADDLE_YELLOW "%s\n" PADDLE_CONON, __VA_ARGS__); \ fflush(stderr) -#define ANDROIDLOGW(...) \ - __android_log_print(ANDROID_LOG_WARNING, ANDROID_LOG_TAG, __VA_ARGS__); \ - fprintf(stderr, "%s\n", __VA_ARGS__); \ +#define ANDROIDLOGW(...) \ + __android_log_print(ANDROID_LOG_WARN, ANDROID_LOG_TAG, __VA_ARGS__); \ + fprintf(stderr, PADDLE_LIGHT_RED "%s\n" PADDLE_CONON, __VA_ARGS__); \ fflush(stderr) #define ANDROIDLOGD(...) \ __android_log_print(ANDROID_LOG_DEBUG, ANDROID_LOG_TAG, __VA_ARGS__); \ - fprintf(stderr, "%s\n", __VA_ARGS__); \ + fprintf(stderr, PADDLE_WHITE "%s\n" PADDLE_CONON, __VA_ARGS__); \ fflush(stderr) #define ANDROIDLOGE(...) \ __android_log_print(ANDROID_LOG_ERROR, ANDROID_LOG_TAG, __VA_ARGS__); \ - fprintf(stderr, "%s\n", __VA_ARGS__); \ + fprintf(stderr, PADDLE_RED "%s\n" PADDLE_CONON, __VA_ARGS__); \ + fflush(stderr) +#define ANDROIDLOGV(...) \ + __android_log_print(ANDROID_LOG_VERBOSE, ANDROID_LOG_TAG, __VA_ARGS__); \ + fprintf(stderr, PADDLE_GREEN "%s\n" PADDLE_CONON, __VA_ARGS__); \ fflush(stderr) #else #define ANDROIDLOGI(...) #define ANDROIDLOGW(...) #define ANDROIDLOGD(...) #define ANDROIDLOGE(...) +#define ANDROIDLOGV(...) #endif @@ -63,6 +84,7 @@ enum LogLevel { kLOG_ERROR, kLOG_WARNING, kLOG_INFO, + kLOG_VERBOSE, kLOG_DEBUG, kLOG_DEBUG1, kLOG_DEBUG2, @@ -73,9 +95,9 @@ enum LogLevel { // log level static LogLevel log_level = kLOG_DEBUG4; -static std::vector logs{"NO", "ERROR ", "WARNING", - "INFO ", "DEBUG ", "DEBUG1 ", - "DEBUG2 ", "DEBUG3 ", "DEBUG4 "}; +static std::vector logs{"NO ", "ERROR ", "WARNING", "INFO ", + "VERBOSE", "DEBUG ", "DEBUG1 ", "DEBUG2 ", + "DEBUG3 ", "DEBUG4 "}; struct ToLog; struct Print; @@ -97,9 +119,27 @@ struct Print { #else std::cerr << buffer_.str() << std::endl; #endif - } else { + } else if (level == kLOG_INFO) { #ifdef ANDROID ANDROIDLOGI(buffer_.str().c_str()); +#else + std::cerr << buffer_.str() << std::endl; +#endif + } else if (level == kLOG_VERBOSE) { +#ifdef ANDROID + ANDROIDLOGV(buffer_.str().c_str()); +#else + std::cerr << buffer_.str() << std::endl; +#endif + } else if (level == kLOG_WARNING) { +#ifdef ANDROID + ANDROIDLOGW(buffer_.str().c_str()); +#else + std::cerr << buffer_.str() << std::endl; +#endif + } else { +#ifdef ANDROID + ANDROIDLOGD(buffer_.str().c_str()); #else std::cout << buffer_.str() << std::endl; #endif @@ -131,6 +171,7 @@ struct ToLog { #define LOG(level) \ if (level > paddle_mobile::log_level) { \ + /* NOLINTNEXTLINE */ \ } else \ paddle_mobile::ToLog( \ level, static_cast( \ @@ -143,6 +184,7 @@ struct ToLog { #define DLOG \ if (paddle_mobile::kLOG_DEBUG > paddle_mobile::log_level) { \ + /* NOLINTNEXTLINE */ \ } else \ paddle_mobile::ToLog( \ paddle_mobile::kLOG_DEBUG, \ @@ -156,11 +198,13 @@ struct ToLog { #define LOGF(level, format, ...) \ if (level > paddle_mobile::log_level) { \ + /* NOLINTNEXTLINE */ \ } else \ printf(format, ##__VA_ARGS__) #define DLOGF(format, ...) \ if (paddle_mobile::kLOG_DEBUG > paddle_mobile::log_level) { \ + /* NOLINTNEXTLINE */ \ } else \ printf(format, ##__VA_ARGS__) @@ -170,12 +214,14 @@ struct ToLog { #define ANDROIDLOGW(...) #define ANDROIDLOGD(...) #define ANDROIDLOGE(...) +#define ANDROIDLOGV(...) enum LogLevel { kNO_LOG, kLOG_ERROR, kLOG_WARNING, kLOG_INFO, + kLOG_VERBOSE, kLOG_DEBUG, kLOG_DEBUG1, kLOG_DEBUG2, @@ -193,7 +239,7 @@ struct Print { }; struct ToLog { - ToLog(LogLevel level) {} + explicit ToLog(LogLevel level) {} template ToLog &operator<<(T const &value) { @@ -201,14 +247,16 @@ struct ToLog { } }; -#define LOG(level) \ - if (true) { \ - } else \ +#define LOG(level) \ + if (true) { \ + /* NOLINTNEXTLINE */ \ + } else \ paddle_mobile::ToLog(level) -#define DLOG \ - if (true) { \ - } else \ +#define DLOG \ + if (true) { \ + /* NOLINTNEXTLINE */ \ + } else \ paddle_mobile::ToLog(paddle_mobile::kLOG_DEBUG) #define LOGF(level, format, ...) diff --git a/mobile/src/framework/executor.cpp b/mobile/src/framework/executor.cpp index 743dea76aef58a582810a50c3f646a8875d1cacc..169ab63307b37af89e4c19a7dcb41d4b640d3db5 100644 --- a/mobile/src/framework/executor.cpp +++ b/mobile/src/framework/executor.cpp @@ -554,8 +554,8 @@ PMStatus Executor::Predict() { clock_gettime(CLOCK_MONOTONIC, &ts); profile[op_index].runBegin = (uint64_t)ts.tv_sec * 1e9 + ts.tv_nsec; #endif - DLOG << i << "th, " - << "run op: " << op_handler->Type(); + LOG(paddle_mobile::kLOG_INFO) << i << "th, " + << "run op: " << op_handler->Type(); if (lod_mode_ && input_dim_has_changed_) { op_handler->InferShape(); } diff --git a/mobile/src/operators/kernel/arm/convolution/conv_common.cpp b/mobile/src/operators/kernel/arm/convolution/conv_common.cpp index c0906e23a39040c76729756f05bcad9b7bdd4b07..dd3843afef39573c03544f30501446436040ad94 100644 --- a/mobile/src/operators/kernel/arm/convolution/conv_common.cpp +++ b/mobile/src/operators/kernel/arm/convolution/conv_common.cpp @@ -12,6 +12,8 @@ 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. */ +#ifdef CONV_OP + #include "operators/kernel/arm/convolution/conv_common.h" #include "framework/context.h" #include "operators/math/gemm/gemm1x1s1.h" @@ -111,3 +113,4 @@ void InitBaseConvKernel(ConvParam *param) { } // namespace operators } // namespace paddle_mobile +#endif diff --git a/mobile/src/operators/kernel/central-arm-func/conv_arm_func.cpp b/mobile/src/operators/kernel/central-arm-func/conv_arm_func.cpp index 43bdbd532a8ee2d615c4ef26d9fd1e7a37edf62d..606a7f1ddc2870562d27efd71b8f70cd921ffa58 100644 --- a/mobile/src/operators/kernel/central-arm-func/conv_arm_func.cpp +++ b/mobile/src/operators/kernel/central-arm-func/conv_arm_func.cpp @@ -11,6 +11,7 @@ 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. */ +#ifdef CONV_OP #include "operators/kernel/central-arm-func/conv_arm_func.h" #include @@ -375,3 +376,4 @@ template void DepthwiseConv5x5(const ConvParam ¶m); } // namespace operators } // namespace paddle_mobile +#endif diff --git a/mobile/src/operators/kernel/cl/cl-kernel-func/conv_func.cpp b/mobile/src/operators/kernel/cl/cl-kernel-func/conv_func.cpp index 5c92cdbfd0001cc277d59fc9a6d5c526a43b61ed..72d94ced5d11557c4961d0cc0a8f416355ae217c 100644 --- a/mobile/src/operators/kernel/cl/cl-kernel-func/conv_func.cpp +++ b/mobile/src/operators/kernel/cl/cl-kernel-func/conv_func.cpp @@ -11,6 +11,7 @@ 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. */ +#ifdef CONV_OP #include "operators/kernel/cl/cl-kernel-func/conv_func.h" #include @@ -1123,3 +1124,4 @@ void ConvTranspose3x3s2AddBnRelu(framework::CLHelper *cl_helper, } } // namespace operators } // namespace paddle_mobile +#endif diff --git a/mobile/src/operators/kernel/cl/cl-kernel-func/instancenorm_func.cpp b/mobile/src/operators/kernel/cl/cl-kernel-func/instancenorm_func.cpp index eabbfe5be4f67345a0919665def8509d640ed386..1f25d3436e6668bf3c01a8dbe3484dbb92fa921d 100644 --- a/mobile/src/operators/kernel/cl/cl-kernel-func/instancenorm_func.cpp +++ b/mobile/src/operators/kernel/cl/cl-kernel-func/instancenorm_func.cpp @@ -11,7 +11,7 @@ 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. */ - +#ifdef INSTANCENORM_OP #include "operators/kernel/cl/cl-kernel-func/instancenorm_func.h" #include namespace paddle_mobile { @@ -75,3 +75,4 @@ void InstanceNorm(framework::CLHelper *cl_helper, } } // namespace operators } // namespace paddle_mobile +#endif diff --git a/mobile/test/CMakeLists.txt b/mobile/test/CMakeLists.txt index 305355a1bc76939c9c333582cd6370af3b3b8fbb..76ddd78f1af8989eed1813380e7e1c642f0b394e 100644 --- a/mobile/test/CMakeLists.txt +++ b/mobile/test/CMakeLists.txt @@ -45,7 +45,7 @@ if (CON GREATER -1) set(FOUND_MATCH ON) # gen test - ADD_EXECUTABLE(test-mobilenetgpu net/test_mobilenet_GPU.cpp test_helper.h test_include.h) + ADD_EXECUTABLE(test-mobilenetgpu net/test_mobilenet_GPU.cpp test_helper.h test_include.h) target_link_libraries(test-mobilenetgpu paddle-mobile) endif () @@ -105,7 +105,7 @@ if (CON GREATER -1) ADD_EXECUTABLE(test-marker-api fpga/test_marker_api.cpp) target_link_libraries(test-marker-api paddle-mobile) - + #ADD_EXECUTABLE(test-marker2 fpga/test_marker2.cpp test_helper.h test_include.h executor_for_test.h ) #target_link_libraries(test-marker2 paddle-mobile) @@ -193,13 +193,16 @@ endif () list(FIND NET "op" CON) if (CON GREATER -1) - # gen test - ADD_EXECUTABLE(test-sigmoid operators/test_sigmoid_op.cpp test_include.h) - target_link_libraries(test-sigmoid paddle-mobile) - + # # gen test + # ADD_EXECUTABLE(test-sigmoid operators/test_sigmoid_op.cpp test_include.h) + # target_link_libraries(test-sigmoid paddle-mobile) + # + # # gen test log + # ADD_EXECUTABLE(test-leakyrelu operators/test_leaky_relu_op.cpp) + # target_link_libraries(test-leakyrelu paddle-mobile) # gen test log - ADD_EXECUTABLE(test-leakyrelu operators/test_leaky_relu_op.cpp) - target_link_libraries(test-leakyrelu paddle-mobile) + ADD_EXECUTABLE(test-log common/test_log.cpp) + target_link_libraries(test-log paddle-mobile) set(FOUND_MATCH ON) endif () @@ -208,333 +211,332 @@ if (ENABLE_ALL_TEST) # 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-expend-op operators/test_expend_op.cpp test_helper.h test_include.h executor_for_test_opencl.h ) + ADD_EXECUTABLE(test-expend-op operators/test_expend_op.cpp test_helper.h test_include.h executor_for_test_opencl.h) target_link_libraries(test-expend-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 + + # 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) + 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) + 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) @@ -550,7 +552,7 @@ if (ENABLE_ALL_TEST) ADD_EXECUTABLE(test-inference-api-v2 net/test_inference_api_v2.cpp test_helper.h test_include.h executor_for_test.h) target_link_libraries(test-inference-api-v2 paddle-mobile) endif () -else() +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) @@ -560,4 +562,4 @@ else() ADD_EXECUTABLE(test-inference-api-v2 net/test_inference_api_v2.cpp test_helper.h test_include.h executor_for_test.h) target_link_libraries(test-inference-api-v2 paddle-mobile) -endif() +endif () diff --git a/mobile/test/common/test_log.cpp b/mobile/test/common/test_log.cpp index 9efcf007d01b39d60be42736ec52ec382a5cd775..7ba964d18b4322d6c273bbcddd432d3e638efd22 100644 --- a/mobile/test/common/test_log.cpp +++ b/mobile/test/common/test_log.cpp @@ -15,10 +15,8 @@ limitations under the License. */ #include "common/log.h" int main() { - DLOGF("DASJFDAFJ%d -- %f", 12345, 344.234); - - LOGF(paddle_mobile::kLOG_DEBUG, "DASJFDAFJ%d -- %f", 12345, 344.234); - + LOG(paddle_mobile::kLOG_DEBUG3) << "test debug" + << " next log"; LOG(paddle_mobile::kLOG_DEBUG) << "test debug" << " next log"; @@ -26,9 +24,12 @@ int main() { << " next log"; LOG(paddle_mobile::kLOG_DEBUG2) << "test debug2" << " next log"; + LOG(paddle_mobile::kLOG_INFO) << "INFO!!!"; + LOG(paddle_mobile::kLOG_WARNING) << "WARNING!!!"; + LOG(paddle_mobile::kLOG_VERBOSE) << "VERBOSE!!!"; DLOG << "test DLOG"; - LOG(paddle_mobile::kLOG_ERROR) << " error occur !"; + LOG(paddle_mobile::kLOG_ERROR) << "ERROR !"; return 0; } diff --git a/mobile/tools/op.cmake b/mobile/tools/op.cmake index 100ae78de1688638f8e44b03f8f8369b7fe45f4d..cd84b9cbde2252e2947418c5d6f02ea0097f1527 100755 --- a/mobile/tools/op.cmake +++ b/mobile/tools/op.cmake @@ -273,8 +273,9 @@ endif() list(FIND NET "op" CON) if (CON GREATER -1) message("op enabled") - set(SIGMOID_OP ON) - set(LEAKY_RELU_OP ON) +# set(SIGMOID_OP ON) +# set(LEAKY_RELU_OP ON) + set(BLOG ON) set(FOUND_MATCH ON) endif() @@ -763,4 +764,7 @@ endif() if (GRID_SAMPLER_OP) add_definitions(-DGRID_SAMPLER_OP) endif() +if (BLOG) + add_definitions(-DBLOG) +endif()