MCPcopy Create free account
hub / github.com/OpenNMT/CTranslate2 / get_default_num_threads

Function get_default_num_threads

src/utils.cc:77–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 }
76
77 static inline size_t get_default_num_threads() {
78 constexpr size_t default_num_threads = 4;
79 const size_t max_num_threads = std::thread::hardware_concurrency();
80 if (max_num_threads == 0)
81 return default_num_threads;
82 return std::min(default_num_threads, max_num_threads);
83 }
84
85 void set_num_threads(size_t num_threads) {
86 if (num_threads == 0)

Callers 1

set_num_threadsFunction · 0.85

Calls 1

minFunction · 0.85

Tested by

no test coverage detected