mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-26 03:00:54 +00:00
Remove gsl subodule and replace with a local copy of gsl-lite Refactor for onnxruntime::make_unique gsl::span size and index are now size_t Remove lambda auto argument type detection. Remove constexpr from fail_fast in gsl due to Linux not being happy. Comment out std::stream support due to MacOS std lib broken. Move make_unique into include/core/common so it is accessible for server builds. Relax requirements for onnxruntime/test/providers/cpu/ml/write_scores_test.cc due to x86 build. Add ONNXRUNTIME_ROOT to Server Lib includes so gsl is recognized
19 lines
No EOL
745 B
C++
19 lines
No EOL
745 B
C++
#include "thread_utils.h"
|
|
#include <algorithm>
|
|
|
|
#include <core/common/make_unique.h>
|
|
|
|
namespace onnxruntime {
|
|
namespace concurrency {
|
|
|
|
std::unique_ptr<ThreadPool> CreateThreadPool(const std::string& name, int thread_pool_size) {
|
|
if (thread_pool_size <= 0) { // default
|
|
thread_pool_size = std::max<int>(1, std::thread::hardware_concurrency() / 2);
|
|
}
|
|
|
|
// since we use the main thread for execution we don't have to create any threads on the thread pool when
|
|
// the requested size is 1. For other cases, we will have thread_pool_size + 1 threads for execution
|
|
return thread_pool_size == 1 ? nullptr : onnxruntime::make_unique<concurrency::ThreadPool>(name, thread_pool_size);
|
|
}
|
|
} // namespace concurrency
|
|
} // namespace onnxruntime
|