未验证 提交 2c380625 编写于 作者: J Jiaying Zhao 提交者: GitHub

add GPU_CL for test_net_benchmark. (#2307)

* add GPU_CL for test_net_benchmark.

* test compile

* fix mobile build error
上级 f6b38e34
...@@ -32,7 +32,7 @@ namespace ops = paddle_mobile::operators; ...@@ -32,7 +32,7 @@ namespace ops = paddle_mobile::operators;
#ifdef PADDLE_MOBILE_CPU #ifdef PADDLE_MOBILE_CPU
REGISTER_OPERATOR_CPU(elementwise_mul, ops::ElementwiseMulOp); REGISTER_OPERATOR_CPU(elementwise_mul, ops::ElementwiseMulOp);
#endif #endif
#ifdef PADDLE_MOBILE_CPU #ifdef PADDLE_MOBILE_CL
REGISTER_OPERATOR_CL(elementwise_mul, ops::ElementwiseMulOp); REGISTER_OPERATOR_CL(elementwise_mul, ops::ElementwiseMulOp);
#endif #endif
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
......
...@@ -544,12 +544,6 @@ else() ...@@ -544,12 +544,6 @@ else()
ADD_EXECUTABLE(test-net net/test_net.cpp test_helper.h test_include.h executor_for_test.h) 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) target_link_libraries(test-net paddle-mobile)
ADD_EXECUTABLE(test-super net/test_super.cpp test_helper.h test_include.h executor_for_test.h) ADD_EXECUTABLE(test-net-benchmark net/test_net_benchmark.cpp test_helper.h test_include.h)
target_link_libraries(test-super paddle-mobile) target_link_libraries(test-net-benchmark paddle-mobile)
ADD_EXECUTABLE(test-inference-pre-post net/test_inference_pre_post.cpp)
target_link_libraries(test-inference-pre-post paddle-mobile)
ADD_EXECUTABLE(test-inference-super net/test_inference_super.cpp)
target_link_libraries(test-inference-super paddle-mobile)
endif() endif()
...@@ -17,20 +17,26 @@ limitations under the License. */ ...@@ -17,20 +17,26 @@ limitations under the License. */
#include "../test_include.h" #include "../test_include.h"
int main() { int main() {
#ifdef PADDLE_MOBILE_CL
paddle_mobile::PaddleMobileConfigInternal config;
config.load_when_predict = false;
paddle_mobile::PaddleMobile<paddle_mobile::GPU_CL> paddle_mobile(config);
#else
paddle_mobile::PaddleMobile<paddle_mobile::CPU> paddle_mobile; paddle_mobile::PaddleMobile<paddle_mobile::CPU> paddle_mobile;
#endif
paddle_mobile.SetThreadNum(1); paddle_mobile.SetThreadNum(1);
auto time1 = paddle_mobile::time(); auto time1 = paddle_mobile::time();
auto isok = auto isok = paddle_mobile.Load(std::string(g_mobilenet_combined) + "/model",
paddle_mobile.Load(std::string(g_yolo) + "/model", std::string(g_mobilenet_combined) + "/params",
std::string(g_yolo) + "/params", true, false, 1, true); true, false, 1, false);
if (isok) { if (isok) {
auto time2 = paddle_mobile::time(); auto time2 = paddle_mobile::time();
std::cout << "load cost :" << paddle_mobile::time_diff(time1, time1) << "ms" std::cout << "load cost :" << paddle_mobile::time_diff(time1, time2) << "ms"
<< std::endl; << std::endl;
std::vector<float> input; std::vector<float> input;
std::vector<int64_t> dims{1, 3, 64, 64}; std::vector<int64_t> dims{1, 3, 224, 224};
GetInput<float>(g_test_image_1x3x224x224_banana, &input, dims); GetInput<float>(g_test_image_1x3x224x224_banana, &input, dims);
paddle_mobile::framework::DDim ddim = paddle_mobile::framework::DDim ddim =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册