diff --git a/mace/examples/mace_run.cc b/mace/examples/mace_run.cc index 1e3834f9c585b7fe9cc1c8d03574b22c04535e3c..09146737c42067d1800afdb147bab8ac98c6d4c5 100644 --- a/mace/examples/mace_run.cc +++ b/mace/examples/mace_run.cc @@ -12,7 +12,6 @@ * --output_file=mace.out \ * --device=NEON */ -#include #include #include #include @@ -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 output_shape; - VLOG(0) << "warm up"; - // warm up - for (int i = 0; i < 1; ++i) { - engine.Run(input_data.get(), shape, output_shape); - } + 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"; - VLOG(0) << "Run model"; - timeval tv1, tv2; - gettimeofday(&tv1, NULL); - for (int i = 0; i < round; ++i) { - engine.Run(input_data.get(), shape, output_shape); + if (round > 0) { + VLOG(0) << "Run model"; + t0 = utils::NowMicros(); + for (int i = 0; i < round; ++i) { + engine.Run(input_data.get(), shape, output_shape); + } + t1 = utils::NowMicros(); + LOG(INFO) << "Avg duration: " << (t1 - t0) / (double)round << " us"; } - gettimeofday(&tv2, NULL); - std::cout << "avg duration: " - << ((tv2.tv_sec - tv1.tv_sec) * 1000 + - (tv2.tv_usec - tv1.tv_usec) / 1000) / - round - << endl; const float *output = engine.Run(input_data.get(), shape, output_shape); if (output != nullptr) { @@ -159,4 +155,4 @@ int main(int argc, char **argv) { ss << "]"; VLOG(0) << ss.str(); } -} \ No newline at end of file +} diff --git a/tools/validate_gcn.sh b/tools/validate_gcn.sh index bd0cb6b3e7be434aff2ea65d3378ec36ea061edf..d97f70566f1039a372adc7dda9e33d7f5fd46180 100644 --- a/tools/validate_gcn.sh +++ b/tools/validate_gcn.sh @@ -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