提交 bcdb3026 编写于 作者: L Liangliang He

Update gcn script and mace_run

上级 84e14b2d
......@@ -12,7 +12,6 @@
* --output_file=mace.out \
* --device=NEON
*/
#include <sys/time.h>
#include <fstream>
#include <numeric>
#include <iostream>
......@@ -99,7 +98,7 @@ int main(int argc, char **argv) {
int64_t t0 = utils::NowMicros();
NetDef net_def = mace::MACE_MODEL_FUNCTION();
int64_t t1 = utils::NowMicros();
LOG(INFO) << "CreateNetDef duration: " << t1 - t0 << "us";
LOG(INFO) << "CreateNetDef duration: " << t1 - t0 << " us";
int64_t init_micros = t1 - t0;
DeviceType device_type = ParseDeviceType(device);
......@@ -119,29 +118,26 @@ int main(int argc, char **argv) {
mace::MaceEngine engine(&net_def, device_type);
t1 = utils::NowMicros();
init_micros += t1 - t0;
LOG(INFO) << "Net init duration: " << t1 - t0 << "us";
LOG(INFO) << "Net init duration: " << t1 - t0 << " us";
LOG(INFO) << "Total init duration: " << init_micros << "us";
LOG(INFO) << "Total init duration: " << init_micros << " us";
std::vector<int64_t> output_shape;
VLOG(0) << "warm up";
// warm up
for (int i = 0; i < 1; ++i) {
VLOG(0) << "Warm up";
t0 = utils::NowMicros();
engine.Run(input_data.get(), shape, output_shape);
}
t1 = utils::NowMicros();
LOG(INFO) << "1st warm up run duration: " << t1 - t0 << " us";
if (round > 0) {
VLOG(0) << "Run model";
timeval tv1, tv2;
gettimeofday(&tv1, NULL);
t0 = utils::NowMicros();
for (int i = 0; i < round; ++i) {
engine.Run(input_data.get(), shape, output_shape);
}
gettimeofday(&tv2, NULL);
std::cout << "avg duration: "
<< ((tv2.tv_sec - tv1.tv_sec) * 1000 +
(tv2.tv_usec - tv1.tv_usec) / 1000) /
round
<< endl;
t1 = utils::NowMicros();
LOG(INFO) << "Avg duration: " << (t1 - t0) / (double)round << " us";
}
const float *output = engine.Run(input_data.get(), shape, output_shape);
if (output != nullptr) {
......
......@@ -53,8 +53,10 @@ build_and_run()
num_threads=${1:-4}
if [[ "${TUNING_OR_NOT}" != "0" && "$EMBED_OPENCL_BINARY" != true ]];then
tuning_flag=1
round=0 # only warm up
else
tuning_flag=0
round=2
fi
adb </dev/null shell MACE_TUNING=${tuning_flag} \
......@@ -70,7 +72,7 @@ build_and_run()
--input_file=${PHONE_DATA_DIR}/${INPUT_FILE_NAME} \
--output_file=${PHONE_DATA_DIR}/${OUTPUT_FILE_NAME} \
--device=OPENCL \
--round=2
--round=$round
}
echo "Step 1: Generate input data"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册