From c9c4e1f077bcc8f44281eaeca07026a658a6444d Mon Sep 17 00:00:00 2001 From: ct-clmsn Date: Thu, 28 Dec 2023 12:53:43 -0500 Subject: [PATCH] reorder operations --- llama.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/llama.cpp b/llama.cpp index 341ec6fc7..e28354e63 100644 --- a/llama.cpp +++ b/llama.cpp @@ -8936,12 +8936,17 @@ static void llama_model_quantize_internal(const std::string & fname_inp, const s return hpx::make_ready_future(); }; - hpx::future this_fut = computefn(0, counters[0], thread_local_hist, local_sizes); for (int it = 1; it < nthread_use - 1; ++it) { futures.push_back(hpx::run_as_hpx_thread(computefn, it, counters[it], thread_local_hist, local_sizes)); } + + hpx::future this_fut = + computefn(0, counters[0], thread_local_hist, local_sizes); + hpx::wait_all(futures); + this_fut.wait(); + for(auto & local_hist : thread_local_hist) { for(auto j = 0; j < int(local_hist.size()); ++j) { hist_cur[j] += local_hist[j];