| 57 | } |
| 58 | |
| 59 | bool MainUtil::RunMultiThread(const std::string& in, const std::string& out, |
| 60 | int thread_num) { |
| 61 | DXINFO("Runing %s...", task_name()); |
| 62 | |
| 63 | vec_str_t in_files; |
| 64 | if (!io_util::ListFile(in, &in_files)) { |
| 65 | return false; |
| 66 | } |
| 67 | |
| 68 | MakeDir(out); |
| 69 | |
| 70 | thread_num = std::min(thread_num, (int)in_files.size()); |
| 71 | if (!io_util::ParallelProcess<std::string>( |
| 72 | in_files, |
| 73 | [this, &out](const vec_str_t& in_files, int thread_id) { |
| 74 | return RunEntry(thread_id, in_files, out); |
| 75 | }, |
| 76 | thread_num)) { |
| 77 | DXERROR("Failed to run %s.", task_name()); |
| 78 | return false; |
| 79 | } |
| 80 | |
| 81 | DXINFO("Done."); |
| 82 | return true; |
| 83 | } |
| 84 | |
| 85 | bool MainUtil::DumpText(deepx_core::AutoOutputFileStream& ofs /* NOLINT */, |
| 86 | std::ostringstream& oss /* NOLINT*/, |