From 09b0b3a49ba757ef44b5e8387eab3a9af4521c0d Mon Sep 17 00:00:00 2001 From: niansa Date: Fri, 23 Jun 2023 16:13:32 +0200 Subject: [PATCH] Wait for all threads to finish --- ggml-vulkan.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ggml-vulkan.cpp b/ggml-vulkan.cpp index 5e1d206bd..c35509bd8 100644 --- a/ggml-vulkan.cpp +++ b/ggml-vulkan.cpp @@ -511,6 +511,12 @@ void ggml_vk_graph_compute(struct ggml_kompute_context * ctx, struct ggml_cgraph } }); } + + // Wait for all threads to finish + for (auto& thread : threads) { + if (thread.joinable()) + thread.join(); + } }