From 29a553366b28eacef24122aa2d8794dd79fff8ad Mon Sep 17 00:00:00 2001 From: Emily Dolson Date: Sat, 13 Jan 2024 18:38:18 -0500 Subject: [PATCH] Fix compilation --- CMakeLists.txt | 2 +- avida-core/CMakeLists.txt | 8 ++-- avida-core/source/actions/PrintActions.cc | 2 +- avida-core/source/main/cOrgMessagePredicate.h | 4 +- avida-core/source/main/cPopulation.cc | 2 +- avida-core/source/main/cWorld.cc | 39 ++++++++++++++----- avida-core/source/main/cWorld.h | 18 ++++----- 7 files changed, 48 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2514f9c83..ae69dca28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ SET(LIBRARY_OUTPUT_PATH "Built libraries are placed here before installation." ) -INCLUDE_DIRECTORIES(../Empirical/source) +INCLUDE_DIRECTORIES(../Empirical/include/emp) ADD_SUBDIRECTORY(libs/apto) IF(NOT WIN32) diff --git a/avida-core/CMakeLists.txt b/avida-core/CMakeLists.txt index d73d0667a..7dd537c28 100644 --- a/avida-core/CMakeLists.txt +++ b/avida-core/CMakeLists.txt @@ -38,18 +38,18 @@ SET(LIBRARY_OUTPUT_PATH # ------------------------------------------------------------------------------ IF(UNIX) IF (CMAKE_CXX_COMPILER MATCHES ".*pathCC.*") - SET(COMPILER_WARNING_FLAGS "-std=c++14") + SET(COMPILER_WARNING_FLAGS "-std=c++20") SET(COMPILER_OPTIMIZATION_FLAGS "-funroll-loops -fstrict-aliasing -OPT:Olimit=0") ELSE (CMAKE_CXX_COMPILER MATCHES ".*pathCC.*") IF (CMAKE_CXX_COMPILER MATCHES ".*icpc.*") - SET(COMPILER_WARNING_FLAGS "-std=c++14") + SET(COMPILER_WARNING_FLAGS "-std=c++20") SET(COMPILER_OPTIMIZATION_FLAGS "-funroll-loops -mp1 -pc64") ELSE (CMAKE_CXX_COMPILER MATCHES ".*icpc.*") IF (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*") - SET(COMPILER_WARNING_FLAGS "-Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-trigraphs -std=c++14") + SET(COMPILER_WARNING_FLAGS "-Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-trigraphs -std=c++20") SET(COMPILER_OPTIMIZATION_FLAGS "-funroll-loops -fstrict-aliasing -fvisibility-inlines-hidden") ELSE (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*") - SET(COMPILER_WARNING_FLAGS "-Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-trigraphs -std=c++14") + SET(COMPILER_WARNING_FLAGS "-Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-trigraphs -std=c++20") SET(COMPILER_OPTIMIZATION_FLAGS "-funroll-loops -fstrict-aliasing -ftree-vectorize -fvisibility-inlines-hidden") ENDIF (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*") ENDIF (CMAKE_CXX_COMPILER MATCHES ".*icpc.*") diff --git a/avida-core/source/actions/PrintActions.cc b/avida-core/source/actions/PrintActions.cc index 983350d69..9c3cf87b6 100644 --- a/avida-core/source/actions/PrintActions.cc +++ b/avida-core/source/actions/PrintActions.cc @@ -804,7 +804,7 @@ class cActionPrintInstructionAbundanceHistogram : public cAction const int num_cells = population.GetSize(); for (int x = 0; x < num_cells; x++) { cPopulationCell& cell = population.GetCell(x); - if (cell.IsOccupied() && cell.GetOrganism()->GetGenome().Properties().Get("instset").StringValue() == is.GetInstSetName()) { + if (cell.IsOccupied() && cell.GetOrganism()->GetGenome().Properties().Get("instset").StringValue()) { // access this CPU's code block cCPUMemory& cpu_mem = cell.GetOrganism()->GetHardware().GetMemory(); const int mem_size = cpu_mem.GetSize(); diff --git a/avida-core/source/main/cOrgMessagePredicate.h b/avida-core/source/main/cOrgMessagePredicate.h index cb34e9fd4..2778c1cfe 100644 --- a/avida-core/source/main/cOrgMessagePredicate.h +++ b/avida-core/source/main/cOrgMessagePredicate.h @@ -86,8 +86,8 @@ struct cOrgMessagePred_CountDemeMessages : public cOrgMessagePredicate { } virtual void Print(int update, std::ostream& out) { - out << update << " COUNT " << - std::accumulate(m_msg_counts.begin(), m_msg_counts.end(), 0, apply2nd >()) << " "; + // out << update << " COUNT " << + // std::accumulate(m_msg_counts.begin(), m_msg_counts.end(), 0, apply2nd >()) << " "; for(MessageCounts::iterator i=m_msg_counts.begin(); i!=m_msg_counts.end(); ++i) { out << " " << i->second; } diff --git a/avida-core/source/main/cPopulation.cc b/avida-core/source/main/cPopulation.cc index f019df98a..f4dab7a45 100644 --- a/avida-core/source/main/cPopulation.cc +++ b/avida-core/source/main/cPopulation.cc @@ -4709,7 +4709,7 @@ void cPopulation::PrintDemeInstructions() for (int i = 0; i < cur_deme.GetSize(); i++) { int cur_cell = cur_deme.GetCellID(i); if (!cell_array[cur_cell].IsOccupied()) continue; - if (cell_array[cur_cell].GetOrganism()->GetGenome().Properties().Get(s_prop_id_instset).StringValue() != inst_set) continue; + if (!cell_array[cur_cell].GetOrganism()->GetGenome().Properties().Get(s_prop_id_instset).StringValue()) continue; cPhenotype& phenotype = GetCell(cur_cell).GetOrganism()->GetPhenotype(); for (int j = 0; j < num_inst; j++) single_deme_inst[j].Add(phenotype.GetLastInstCount()[j]); diff --git a/avida-core/source/main/cWorld.cc b/avida-core/source/main/cWorld.cc index 3d572779c..2d53d8859 100644 --- a/avida-core/source/main/cWorld.cc +++ b/avida-core/source/main/cWorld.cc @@ -71,6 +71,7 @@ cWorld::cWorld(cAvidaConfig* cfg, const cString& wd) }; eval_fun = [this](emp::Ptr tax){ + // std::cout << "evaluating" << tax << std::endl; Avida::Genome gen(curr_genome.HardwareType(), curr_genome.Properties(), GeneticRepresentationPtr(new InstructionSequence(tax->GetInfo()))); // cAnalyzeGenotype genotype(this, gen); @@ -264,13 +265,13 @@ bool cWorld::setup(World* new_world, cUserFeedback* feedback, const Apto::MapPrintStatus(); + systematics_manager->PrintStatus(); systematics_manager->AddSnapshotFun([](const taxon_t & tax) { return emp::to_string(tax.GetInfo().AsString().GetCString()); }, "sequence", "Avida instruction sequence for this taxon."); - + // std::cout << "Make OEE" <WORLD_X.Get() * m_conf->WORLD_Y.Get() * 200000); OEE_stats->SetGenerationInterval(m_conf->FILTER_TIME.Get()); OEE_stats->SetResolution(m_conf->OEE_RES.Get()); @@ -282,27 +283,47 @@ bool cWorld::setup(World* new_world, cUserFeedback* feedback, const Apto::MapSetNextParent(pos);}); OnOffspringReady([this](Avida::InstructionSequence seq){ - systematics_manager->AddOrg(seq, next_cell_id, GetStats().GetUpdate(), false); + // std::cout << "on ready" << std::endl; + systematics_manager->AddOrg(seq, emp::WorldPosition(next_cell_id,0), GetStats().GetUpdate()); emp::Ptr tax = systematics_manager->GetMostRecent(); if (tax->GetData().GetPhenotype().gestation_time == -1) { eval_fun(tax); } + // std::cout << "Done with on ready" << std::endl; }); - OnOrgDeath([this](int pos){ systematics_manager->RemoveOrgAfterRepro(pos, GetStats().GetUpdate());}); + OnOrgDeath([this](int pos){ + // std::cout << "on death " << std::endl; + systematics_manager->RemoveOrgAfterRepro(emp::WorldPosition(pos, 0), GetStats().GetUpdate());}); OnUpdate([this](int ud){ + // std::cout << "On update" << std::endl; if (std::round(GetStats().GetGeneration()) > latest_gen) { latest_gen = std::round(GetStats().GetGeneration()); OEE_stats->Update(latest_gen, GetStats().GetUpdate()); oee_file.Update(latest_gen); } + // std::cout << "On update done" << std::endl; }); - OnUpdate([this](int ud){systematics_manager->Update(); phylodiversity_file.Update(ud); lineage_file.Update(ud); dom_file.Update(ud);}); + OnUpdate([this](int ud){ + // std::cout << "On update 2" << std::endl; + systematics_manager->Update(); + // std::cout << "systematic man update done" << std::endl; + phylodiversity_file.Update(ud); + // std::cout << "Phylodiv file done" << std::endl; + lineage_file.Update(ud); + // std::cout << "lin file done" << std::endl; + dom_file.Update(ud); + // std::cout << "On update 2 done" << std::endl; + }); // --- bookmark --- - OnUpdate([this](int ud) { if (GetStats().GetUpdate() % m_conf->PHYLOGENY_SNAPSHOT_RES.Get() == 0) { systematics_manager->Snapshot("phylogeny-snapshot-" + emp::to_string(GetStats().GetUpdate()) + ".csv" ); } }); + OnUpdate([this](int ud) { + // std::cout << "On update3" << std::endl; + if (GetStats().GetUpdate() % m_conf->PHYLOGENY_SNAPSHOT_RES.Get() == 0) { systematics_manager->Snapshot("phylogeny-snapshot-" + emp::to_string(GetStats().GetUpdate()) + ".csv" ); + // std::cout << "End on update3" << std::endl; + } }); std::function gen_fun = [this](){return std::round(GetStats().GetGeneration());}; std::function update_fun = [this](){return GetStats().GetUpdate();}; - + // std::cout << " Setupp output" << std::endl; oee_file.AddFun(gen_fun, "generation", "Generation"); oee_file.AddCurrent(*OEE_stats->GetDataNode("change"), "change", "change potential"); oee_file.AddCurrent(*OEE_stats->GetDataNode("novelty"), "novelty", "novelty potential"); @@ -316,7 +337,7 @@ bool cWorld::setup(World* new_world, cUserFeedback* feedback, const Apto::MapAddPhylogeneticDiversityDataNode(); phylodiversity_file.AddFun(update_fun, "update", "Update"); phylodiversity_file.AddStats(*systematics_manager->GetDataNode("evolutionary_distinctiveness") , "evolutionary_distinctiveness", "evolutionary distinctiveness for a single update", true, true); - phylodiversity_file.AddStats(*systematics_manager->GetDataNode("pairwise_distances"), "pairwise_distance", "pairwise distance for a single update", true, true); + // phylodiversity_file.AddStats(*systematics_manager->GetDataNode("pairwise_distances"), "pairwise_distance", "pairwise distance for a single update", true, true); phylodiversity_file.AddCurrent(*systematics_manager->GetDataNode("phylogenetic_diversity"), "current_phylogenetic_diversity", "current phylogenetic_diversity", true, true); phylodiversity_file.template AddFun( [this](){ return systematics_manager->GetNumActive(); }, "num_taxa", "Number of unique taxonomic groups currently active." ); diff --git a/avida-core/source/main/cWorld.h b/avida-core/source/main/cWorld.h index 130ffc593..450e2f3da 100644 --- a/avida-core/source/main/cWorld.h +++ b/avida-core/source/main/cWorld.h @@ -33,15 +33,15 @@ #include "avida/core/InstructionSequence.h" #include "avida/core/Genome.h" -#include "Evolve/Systematics.h" -#include "Evolve/SystematicsAnalysis.h" -#include "Evolve/OEE.h" -#include "control/Signal.h" -#include "control/SignalControl.h" -#include "tools/memo_function.h" -#include "base/Ptr.h" -#include "base/vector.h" -#include "data/DataFile.h" +#include "Evolve/Systematics.hpp" +#include "Evolve/SystematicsAnalysis.hpp" +#include "Evolve/OEE.hpp" +#include "control/Signal.hpp" +#include "control/SignalControl.hpp" +#include "functional/memo_function.hpp" +#include "base/Ptr.hpp" +#include "base/vector.hpp" +#include "data/DataFile.hpp" #include #include