Skip to content

Commit d4534a7

Browse files
committed
fix: default to get_num_physical_cores for model loading
For consistency, since std::thread::hardware_concurrency can return double the number of cores on SMT machines.
1 parent b27b604 commit d4534a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,7 @@ bool ModelLoader::load_tensors(on_new_tensor_cb_t on_new_tensor_cb, int n_thread
19571957
std::atomic<int64_t> copy_to_backend_time_ms(0);
19581958
std::atomic<int64_t> convert_time_ms(0);
19591959

1960-
int num_threads_to_use = n_threads_p > 0 ? n_threads_p : (int)std::thread::hardware_concurrency();
1960+
int num_threads_to_use = n_threads_p > 0 ? n_threads_p : get_num_physical_cores();
19611961
LOG_DEBUG("using %d threads for model loading", num_threads_to_use);
19621962

19631963
int64_t start_time = ggml_time_ms();

0 commit comments

Comments
 (0)