mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 08:37:06 +08:00
[Benchmark] Remove pmap and use mem api (#1309)
* add GPL lisence * add GPL-3.0 lisence * add GPL-3.0 lisence * add GPL-3.0 lisence * support yolov8 * add pybind for yolov8 * add yolov8 readme * add cpp benchmark * add cpu and gpu mem * public part split * add runtime mode * fixed bugs * add cpu_thread_nums * deal with comments * deal with comments * deal with comments * rm useless code * add FASTDEPLOY_DECL * add FASTDEPLOY_DECL * fixed for windows * mv rss to pss * mv rss to pss * Update utils.cc * use thread to collect mem * Add ResourceUsageMonitor * rm useless code * fixed bug * fixed typo * update ResourceUsageMonitor * fixed bug * fixed bug * add note for ResourceUsageMonitor * deal with comments * add macros * deal with comments * deal with comments * deal with comments * re-lint * rm pmap and use mem api * rm pmap and use mem api * add mem api * Add PrintBenchmarkInfo func * Add PrintBenchmarkInfo func * Add PrintBenchmarkInfo func * deal with comments --------- Co-authored-by: DefTruth <31974251+DefTruth@users.noreply.github.com>
This commit is contained in:
@@ -16,6 +16,12 @@
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
|
||||
#ifdef WIN32
|
||||
const char sep = '\\';
|
||||
#else
|
||||
const char sep = '/';
|
||||
#endif
|
||||
|
||||
DEFINE_string(model, "", "Directory of the inference model.");
|
||||
DEFINE_string(image, "", "Path of the image file.");
|
||||
DEFINE_string(device, "cpu",
|
||||
@@ -48,3 +54,35 @@ void PrintUsage() {
|
||||
std::cout << "Default value of backend: default" << std::endl;
|
||||
std::cout << "Default value of use_fp16: false" << std::endl;
|
||||
}
|
||||
|
||||
void PrintBenchmarkInfo() {
|
||||
// Get model name
|
||||
std::vector<std::string> model_names;
|
||||
fastdeploy::benchmark::Split(FLAGS_model, model_names, sep);
|
||||
// Save benchmark info
|
||||
std::stringstream ss;
|
||||
ss.precision(3);
|
||||
ss << "\n======= Model Info =======\n";
|
||||
ss << "model_name: " << model_names[model_names.size() - 1] << std::endl;
|
||||
ss << "profile_mode: " << FLAGS_profile_mode << std::endl;
|
||||
if (FLAGS_profile_mode == "runtime") {
|
||||
ss << "include_h2d_d2h: " << FLAGS_include_h2d_d2h << std::endl;
|
||||
}
|
||||
ss << "\n======= Backend Info =======\n";
|
||||
ss << "warmup: " << FLAGS_warmup << std::endl;
|
||||
ss << "repeats: " << FLAGS_repeat << std::endl;
|
||||
ss << "device: " << FLAGS_device << std::endl;
|
||||
if (FLAGS_device == "gpu") {
|
||||
ss << "device_id: " << FLAGS_device_id << std::endl;
|
||||
}
|
||||
ss << "backend: " << FLAGS_backend << std::endl;
|
||||
ss << "cpu_thread_nums: " << FLAGS_cpu_thread_nums << std::endl;
|
||||
ss << "use_fp16: " << FLAGS_use_fp16 << std::endl;
|
||||
ss << "collect_memory_info: " << FLAGS_collect_memory_info << std::endl;
|
||||
if (FLAGS_collect_memory_info) {
|
||||
ss << "sampling_interval: " << std::to_string(FLAGS_sampling_interval)
|
||||
<< "ms" << std::endl;
|
||||
}
|
||||
std::cout << ss.str() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user