[Benchmark] Add PaddleYOLOv8 cpp benchmark example & lite flags option (#1270)

* [Android] Add PaddleYOLOv8 cpp benchmark example & lite flags option

* [Benchmark] add linux x86_64 gpu benchmark build script
This commit is contained in:
DefTruth
2023-02-09 11:58:07 +08:00
committed by GitHub
parent 3eb571a047
commit ab5377b5fa
8 changed files with 345 additions and 7 deletions

6
benchmark/cpp/benchmark_yolov5.cc Executable file → Normal file
View File

@@ -65,8 +65,10 @@ bool RunModel(std::string model_file, std::string image_file, size_t warmup,
for (int i = 0; i < repeats; i++) {
if (FLAGS_collect_memory_info && i % dump_period == 0) {
fastdeploy::benchmark::DumpCurrentCpuMemoryUsage(cpu_mem_file_name);
#if defined(WITH_GPU)
fastdeploy::benchmark::DumpCurrentGpuMemoryUsage(gpu_mem_file_name,
FLAGS_device_id);
#endif
}
tc.Start();
if (!model.Predict(im, &res)) {
@@ -102,9 +104,11 @@ int main(int argc, char* argv[]) {
}
if (FLAGS_collect_memory_info) {
float cpu_mem = fastdeploy::benchmark::GetCpuMemoryUsage(cpu_mem_file_name);
float gpu_mem = fastdeploy::benchmark::GetGpuMemoryUsage(gpu_mem_file_name);
std::cout << "cpu_pss_mb: " << cpu_mem << "MB." << std::endl;
#if defined(WITH_GPU)
float gpu_mem = fastdeploy::benchmark::GetGpuMemoryUsage(gpu_mem_file_name);
std::cout << "gpu_pss_mb: " << gpu_mem << "MB." << std::endl;
#endif
}
return 0;
}