From e51064771b28e7a33d2273bf3f264c18e4ebd263 Mon Sep 17 00:00:00 2001 From: Fabian Posch Date: Thu, 30 Jan 2025 23:57:27 +0100 Subject: [PATCH] final fixes --- include/actsim_agent/agent_artifact.hpp | 6 +++- include/cluster/artifact.hpp | 2 +- src/actsim_agent/agent_artifact.cpp | 39 ------------------------- src/actsim_agent/downloader.cpp | 10 ++----- src/actsim_agent/log_parser.cpp | 5 ++-- src/actsim_agent/uploader.cpp | 6 ++-- src/actsim_agent/worker.cpp | 9 ++++++ 7 files changed, 24 insertions(+), 53 deletions(-) delete mode 100644 src/actsim_agent/agent_artifact.cpp diff --git a/include/actsim_agent/agent_artifact.hpp b/include/actsim_agent/agent_artifact.hpp index da3ee8d..3e751d5 100644 --- a/include/actsim_agent/agent_artifact.hpp +++ b/include/actsim_agent/agent_artifact.hpp @@ -40,7 +40,11 @@ class DBSimArtifact : public db::DBArtifact { const db::uuid_t& design, const db::uuid_t& reference, const db::uuid_t& source_config - ); + ) : DBArtifact(id, source_pass, target_artifact) { + this->design_ = design; + this->reference_ = reference; + this->source_config_ = source_config; + }; /** * @brief The UUID of the design this simulation uses diff --git a/include/cluster/artifact.hpp b/include/cluster/artifact.hpp index 4e9ae8f..e232994 100644 --- a/include/cluster/artifact.hpp +++ b/include/cluster/artifact.hpp @@ -242,7 +242,7 @@ class SimConfigArtifact: public Artifact { private: - bool has_reference_; + bool has_reference_ = false; std::vector testcases; }; diff --git a/src/actsim_agent/agent_artifact.cpp b/src/actsim_agent/agent_artifact.cpp deleted file mode 100644 index dcf040b..0000000 --- a/src/actsim_agent/agent_artifact.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -/************************************************************************* - * - * This file is part of the ACT library - * - * Copyright (c) 2024 Fabian Posch - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - ************************************************************************** - */ - -#include "agent_artifact.hpp" - -DBSimArtifact::DBSimArtifact( - const db::uuid_t& id, - const db::uuid_t& source_pass, - const db::uuid_t& target_artifact, - const db::uuid_t& design, - const db::uuid_t& reference, - const db::uuid_t& source_config -) : DBArtifact(id, source_pass, target_artifact) { - this->design_ = design; - this->reference_ = reference; - this->source_config_ = source_config; -} diff --git a/src/actsim_agent/downloader.cpp b/src/actsim_agent/downloader.cpp index 94f13ad..ee79ff2 100644 --- a/src/actsim_agent/downloader.cpp +++ b/src/actsim_agent/downloader.cpp @@ -133,9 +133,9 @@ bool Downloader::fetch_tasks(size_t n) { " sc.has_reference AS reference, " " so.id AS id " "FROM " - " actsim_passes ap " + " sim_configs sc " "JOIN " - " sim_configs sc ON ap.sim_configs = sc.artifact " + " actsim_passes ap ON ap.sim_configs = sc.artifact " "LEFT JOIN " " sim_outputs so ON sc.id = so.sim_config " "JOIN " @@ -193,6 +193,7 @@ bool Downloader::fetch_tasks(size_t n) { auto design = row["design"].as(); db::uuid_t reference; + reference = 0; if (!row["reference"].is_null()) { reference = row["reference"].as(); @@ -417,11 +418,6 @@ std::shared_ptr Downloader::fetch_reference_run(const db: return nullptr; } - std::cout << "Output tokens:" << std::endl; - for (auto&& token: output_token_timings) { - std::cout << token << std::endl; - } - auto reference = std::make_shared(); reference->set_output_token_timings(output_token_timings); reference->set_output_tokens(output_tokens); diff --git a/src/actsim_agent/log_parser.cpp b/src/actsim_agent/log_parser.cpp index c07cad7..3855958 100644 --- a/src/actsim_agent/log_parser.cpp +++ b/src/actsim_agent/log_parser.cpp @@ -23,6 +23,7 @@ ************************************************************************** */ +#include #include #include "util.h" #include "log_parser.hpp" @@ -63,7 +64,7 @@ void LogParser::parse_log(const std::string& line) { } -void LogParser::parse_error(const std::string& line) { +void LogParser::parse_error([[maybe_unused]]const std::string& line) { // DEBUG_PRINT("Parsing error line " + line); @@ -245,7 +246,7 @@ inline void LogParser::check_glitch(const std::string& line) { // simply check if the standard glitch output is given - const std::string glitch_detected = "Glitch detected in channel"; + const std::string glitch_detected = "WARNING: weak-interference on"; if (line.find(glitch_detected) != std::string::npos) { artifact->set_fault_glitch(true); diff --git a/src/actsim_agent/uploader.cpp b/src/actsim_agent/uploader.cpp index eb63aba..7b05929 100644 --- a/src/actsim_agent/uploader.cpp +++ b/src/actsim_agent/uploader.cpp @@ -141,7 +141,7 @@ bool Uploader::upload_task(std::unique_ptr task) { ]( pqxx::work *txn ) { - txn->exec_params0( + txn->exec( "UPDATE sim_outputs SET " " sim_log = $1, " " error_log = $2, " @@ -151,13 +151,13 @@ bool Uploader::upload_task(std::unique_ptr task) { " log_size = $6, " " part_status = 'finished' " "WHERE id = $7 AND part_status != 'halted';", - sim_log, + {sim_log, sim_error, output_tokens, output_token_timings, fault_flags, log_size, - task_id + task_id} ); }; diff --git a/src/actsim_agent/worker.cpp b/src/actsim_agent/worker.cpp index 82cafac..95f5a35 100644 --- a/src/actsim_agent/worker.cpp +++ b/src/actsim_agent/worker.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include "util.h" @@ -138,6 +139,7 @@ std::unique_ptr Worker::perform_task(std::unique_ptr& tas // execv expects mutable char*, so we have to copy our stuff first auto design = this->interface.get_design(task->design); + design = "testbench.act"; char *design_char = new char[design.length()+1]; std::strcpy(design_char, design.c_str()); @@ -499,6 +501,13 @@ std::unique_ptr Worker::perform_task(std::unique_ptr& tas // check if the process has ended ie. all pipes closed if (stdout_closed && stderr_closed) { finished = true; + int exit_code; + waitpid(pid, &exit_code, 0); + + if (exit_code != 0) { + std::cerr << "SIMULATION EXITED ABNORMALLY!" << std::endl; + } + break; }