NO FREE SUPER FAST

thread
Brett 2024-07-13 00:14:48 -04:00
parent d8e67a915c
commit 034071dae3
5 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
project(blt-gp VERSION 0.0.68) project(blt-gp VERSION 0.0.69)
include(CTest) include(CTest)

View File

@ -36,8 +36,8 @@ blt::gp::prog_config_t config = blt::gp::prog_config_t()
.set_initial_max_tree_size(6) .set_initial_max_tree_size(6)
.set_elite_count(0) .set_elite_count(0)
.set_max_generations(50) .set_max_generations(50)
.set_pop_size(5000) .set_pop_size(500)
.set_thread_count(0); .set_thread_count(1);
blt::gp::type_provider type_system; blt::gp::type_provider type_system;
blt::gp::gp_program program{type_system, SEED, config}; blt::gp::gp_program program{type_system, SEED, config};

View File

@ -286,9 +286,16 @@ namespace blt::gp
if (config.threads == 1) if (config.threads == 1)
{ {
thread_execution_service = new std::function([this, &fitness_function]() { thread_execution_service = new std::function([this, &fitness_function]() {
if (thread_helper.evaluation_left > 0) for (const auto& ind : blt::enumerate(current_pop.get_individuals()))
{ {
fitness_function(ind.second.tree, ind.second.fitness, ind.first);
if (ind.second.fitness.adjusted_fitness > current_stats.best_fitness)
current_stats.best_fitness = ind.second.fitness.adjusted_fitness;
if (ind.second.fitness.adjusted_fitness < current_stats.worst_fitness)
current_stats.worst_fitness = ind.second.fitness.adjusted_fitness;
current_stats.overall_fitness = current_stats.overall_fitness + ind.second.fitness.adjusted_fitness;
} }
}); });
} else } else

View File

@ -401,7 +401,8 @@ namespace blt::gp
auto old = head; auto old = head;
head = head->metadata.prev; head = head->metadata.prev;
if (head == nullptr) if (head == nullptr)
free_chain(old); head = old;
//free_chain(old);
// required to prevent silly memory :3 // required to prevent silly memory :3
// if (head != nullptr) // if (head != nullptr)
// head->metadata.next = nullptr; // head->metadata.next = nullptr;

View File

@ -1 +1 @@
perf stat -d -d -d -r 30 -e branches,branch-misses,cache-misses,cache-references,cycles,instructions,alignment-faults,cgroup-switches,faults,duration_time,user_time,system_time,L1-dcache-loads,L1-dcache-load-misses,L1-dcache-prefetches,L1-icache-loads,L1-icache-load-misses,dTLB-loads,dTLB-load-misses,iTLB-loads,iTLB-load-misses,l2_request_g1.all_no_prefetch ./cmake-build-release/blt-SR-playground-example perf stat -d -d -d -r 30 -e branches,branch-misses,cache-misses,cache-references,cycles,instructions,alignment-faults,cgroup-switches,faults,duration_time,user_time,system_time,L1-dcache-loads,L1-dcache-load-misses,L1-dcache-prefetches,L1-icache-loads,L1-icache-load-misses,dTLB-loads,dTLB-load-misses,iTLB-loads,iTLB-load-misses,l2_request_g1.all_no_prefetch,page-faults,page-faults:u,page-faults:k ./cmake-build-release/blt-SR-playground-example