Skip to content

Commit 206bfde

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 209b871 commit 206bfde

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
@@ -1956,7 +1956,7 @@ bool ModelLoader::load_tensors(on_new_tensor_cb_t on_new_tensor_cb, int n_thread
19561956
std::atomic<int64_t> copy_to_backend_time_ms(0);
19571957
std::atomic<int64_t> convert_time_ms(0);
19581958

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

19621962
int64_t start_time = ggml_time_ms();

0 commit comments

Comments
 (0)