提交 36011aaa 编写于 作者: Y yangfei

cl_kernel and test files

上级 893a19b2
...@@ -217,9 +217,9 @@ else () ...@@ -217,9 +217,9 @@ else ()
# ADD_EXECUTABLE(test-depthwise-conv-op operators/test_depthwise_conv_op.cpp test_helper.h test_include.h executor_for_test.h) # 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) # target_link_libraries(test-depthwise-conv-op paddle-mobile)
# #
# # gen test # gen test
# ADD_EXECUTABLE(test-mobilenet net/test_mobilenet.cpp test_helper.h test_include.h executor_for_test.h) 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) target_link_libraries(test-mobilenet paddle-mobile)
# #
# # gen test # # 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) # ADD_EXECUTABLE(test-conv-add-relu-op operators/test_conv_add_relu_op.cpp test_helper.h test_include.h executor_for_test.h)
......
...@@ -19,14 +19,14 @@ limitations under the License. */ ...@@ -19,14 +19,14 @@ limitations under the License. */
int main() { int main() {
paddle_mobile::PaddleMobile<paddle_mobile::CPU> paddle_mobile; paddle_mobile::PaddleMobile<paddle_mobile::CPU> paddle_mobile;
paddle_mobile.SetThreadNum(4); paddle_mobile.SetThreadNum(4);
auto time1 = time(); auto time1 = paddle_mobile::time();
// auto isok = paddle_mobile.Load(std::string(g_mobilenet_detect) + "/model", // auto isok = paddle_mobile.Load(std::string(g_mobilenet_detect) + "/model",
// std::string(g_mobilenet_detect) + "/params", true); // std::string(g_mobilenet_detect) + "/params", true);
auto isok = paddle_mobile.Load(g_mobilenet, true); auto isok = paddle_mobile.Load(g_mobilenet, true);
if (isok) { if (isok) {
auto time2 = time(); auto time2 = paddle_mobile::time();
std::cout << "load cost :" << time_diff(time1, time1) << "ms" << std::endl; std::cout << "load cost :" << paddle_mobile::time_diff(time1, time1) << "ms" << std::endl;
std::vector<float> input; std::vector<float> input;
std::vector<int64_t> dims{1, 3, 224, 224}; std::vector<int64_t> dims{1, 3, 224, 224};
...@@ -42,13 +42,13 @@ int main() { ...@@ -42,13 +42,13 @@ int main() {
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
auto vec_result = paddle_mobile.Predict(input, dims); auto vec_result = paddle_mobile.Predict(input, dims);
} }
auto time3 = time(); auto time3 = paddle_mobile::time();
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
auto vec_result = paddle_mobile.Predict(input, dims); auto vec_result = paddle_mobile.Predict(input, dims);
} }
DLOG << vec_result; DLOG << vec_result;
auto time4 = time(); auto time4 = paddle_mobile::time();
std::cout << "predict cost :" << time_diff(time3, time4) / 10 << "ms" std::cout << "predict cost :" << paddle_mobile::time_diff(time3, time4) / 10 << "ms"
<< std::endl; << std::endl;
} }
......
#!/usr/bin/env sh #!/usr/bin/env sh
push_fn () { push_fn () {
cp ../../src/operators/kernel/cl/cl_kernel/* ../../build/release/arm-v7a/build/cl_kernel/
MODELS_PATH="../../test/models/*" MODELS_PATH="../../test/models/*"
MODELS_SRC="../../test/models" MODELS_SRC="../../test/models"
IMAGE_PATH="../../test/images/*" IMAGE_PATH="../../test/images/*"
EXE_FILE="../../test/build/*" EXE_FILE="../../test/build/*"
EXE_DIR="data/local/tmp/bin" EXE_DIR="data/local/tmp/bin"
adb shell mkdir ${EXE_DIR} adb shell mkdir ${EXE_DIR}
MODELS_DIR="data/local/tmp/models" MODELS_DIR="/data/local/tmp"
adb shell mkdir ${MODELS_DIR} adb shell mkdir ${MODELS_DIR}
for file in `ls ${MODELS_SRC}` for file in `ls ${MODELS_SRC}`
do do
...@@ -24,11 +19,15 @@ ACL_BUILD_PATH="../../src/operators/kernel/mali/ACL_Android/build/*" ...@@ -24,11 +19,15 @@ ACL_BUILD_PATH="../../src/operators/kernel/mali/ACL_Android/build/*"
adb push ${ACL_BUILD_PATH} ${EXE_DIR} adb push ${ACL_BUILD_PATH} ${EXE_DIR}
fi fi
IMAGES_DIR="data/local/tmp/images" IMAGES_DIR="/data/local/tmp"
adb shell mkdir ${IMAGES_DIR} adb shell mkdir ${IMAGES_DIR}
LIB_PATH="../../build/release/arm-v7a/build/*" LIB_PATH="../../build/release/arm-v7a/build/*"
adb push ${EXE_FILE} ${EXE_DIR} adb push ${EXE_FILE} ${EXE_DIR}
adb push ${LIB_PATH} ${EXE_DIR} for file in ${LIB_PATH}
do
adb push ${file} ${EXE_DIR}
done
if [[ $1 != "npm" ]]; then if [[ $1 != "npm" ]]; then
adb push ${IMAGE_PATH} ${IMAGES_DIR} adb push ${IMAGE_PATH} ${IMAGES_DIR}
adb push ${MODELS_PATH} ${MODELS_DIR} adb push ${MODELS_PATH} ${MODELS_DIR}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册