MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / postprocess_cpu_params

Function postprocess_cpu_params

subprojects/llama.cpp/common/common.cpp:268–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266
267
268void postprocess_cpu_params(cpu_params& cpuparams, const cpu_params* role_model) {
269 int32_t n_set = 0;
270
271 if (cpuparams.n_threads < 0) {
272 // Assuming everything about cpuparams is invalid
273 if (role_model != nullptr) {
274 cpuparams = *role_model;
275 } else {
276 cpuparams.n_threads = cpu_get_num_math();
277 }
278 }
279
280 for (int32_t i = 0; i < GGML_MAX_N_THREADS; i++) {
281 if (cpuparams.cpumask[i]) {
282 n_set++;
283 }
284 }
285
286 if (n_set && n_set < cpuparams.n_threads) {
287 // Not enough set bits, may experience performance issues.
288 LOG_WRN("Not enough set bits in CPU mask (%d) to satisfy requested thread count: %d\n", n_set, cpuparams.n_threads);
289 }
290}
291
292bool parse_cpu_range(const std::string & range, bool (&boolmask)[GGML_MAX_N_THREADS]) {
293 size_t dash_loc = range.find('-');

Callers 1

common_params_parse_exFunction · 0.85

Calls 1

cpu_get_num_mathFunction · 0.85

Tested by

no test coverage detected