From 18ef85c1ce9af5994a667097f900409ea25b3131 Mon Sep 17 00:00:00 2001 From: Brett Date: Sat, 17 Aug 2024 04:35:44 -0400 Subject: [PATCH] what --- CMakeLists.txt | 2 +- include/blt/gp/program.h | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 17ba75d..38e4f2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(blt-gp VERSION 0.1.3) +project(blt-gp VERSION 0.1.4) include(CTest) diff --git a/include/blt/gp/program.h b/include/blt/gp/program.h index 6d3c091..6a41def 100644 --- a/include/blt/gp/program.h +++ b/include/blt/gp/program.h @@ -378,6 +378,30 @@ namespace blt::gp } } } + if (thread_helper.next_gen_left > 0) + { + while (thread_helper.next_gen_left > 0) + { + blt::size_t size = 0; + blt::size_t begin = 0; + blt::size_t end = thread_helper.next_gen_left.load(std::memory_order_relaxed); + do + { + size = std::min(end, config.evaluation_size); + begin = end - size; + } while (!thread_helper.next_gen_left.compare_exchange_weak(end, end - size, + std::memory_order::memory_order_relaxed, + std::memory_order::memory_order_relaxed)); + + static thread_local std::vector new_children; + new_children.clear(); + + for (blt::size_t i = begin; i < end; i++) + { + + } + } + } thread_helper.barrier.wait(); }); thread_helper.thread_function_condition.notify_all(); @@ -584,6 +608,7 @@ namespace blt::gp std::condition_variable thread_function_condition{}; std::atomic_uint64_t evaluation_left = 0; + std::atomic_uint64_t next_gen_left = 0; std::atomic_bool lifetime_over = false; blt::barrier barrier;