From bd45f7e18cfdd54d7a8b5a032b06cbe8d027cc6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de> Date: Mon, 22 Jan 2024 12:49:44 +0100 Subject: [PATCH] chore: Drop support for EXTOLL connection Change-Id: I0b21cf03bb1b397f273ca92a8b67feb8df0a70aa --- include/hxcomm/common/extollconnection.h | 266 ----------- include/hxcomm/common/extollconnection.tcc | 18 - .../hxcomm/common/extollconnection_impl.tcc | 420 ------------------ include/hxcomm/common/fpga_ip_list.h | 19 - include/hxcomm/vx/connection_from_env.h | 2 +- include/hxcomm/vx/connection_variant.h | 6 - include/hxcomm/vx/extollconnection.h | 17 - .../include/pyhxcomm/vx/extollconnection.h | 17 - .../include/pyhxcomm/vx/python_bindings.h | 3 - src/hxcomm/common/fpga_ip_list.cpp | 38 -- src/hxcomm/vx/connection_from_env.cpp | 49 -- src/hxcomm/vx/extollconnection.cpp | 12 - wscript | 14 +- 13 files changed, 2 insertions(+), 879 deletions(-) delete mode 100644 include/hxcomm/common/extollconnection.h delete mode 100644 include/hxcomm/common/extollconnection.tcc delete mode 100644 include/hxcomm/common/extollconnection_impl.tcc delete mode 100644 include/hxcomm/vx/extollconnection.h delete mode 100644 pyhxcomm/include/pyhxcomm/vx/extollconnection.h delete mode 100644 src/hxcomm/vx/extollconnection.cpp diff --git a/include/hxcomm/common/extollconnection.h b/include/hxcomm/common/extollconnection.h deleted file mode 100644 index 287382c..0000000 --- a/include/hxcomm/common/extollconnection.h +++ /dev/null @@ -1,266 +0,0 @@ -#pragma once - -#include "bss_hw_params/cube_extoll/constants.h" -#include "hate/visibility.h" -#include "hxcomm/common/connect_to_remote_parameter_defs.h" -#include "hxcomm/common/connection.h" -#include "hxcomm/common/connection_registry.h" -#include "hxcomm/common/connection_time_info.h" -#include "hxcomm/common/decoder.h" -#include "hxcomm/common/encoder.h" -#include "hxcomm/common/listener_halt.h" -#include "hxcomm/common/stream.h" -#include "hxcomm/common/target.h" -#include "hxcomm/common/utmessage.h" -#include "nhtl-extoll/connection.h" -#include "nhtl-extoll/get_node_ids.h" -#include <array> -#include <atomic> -#include <memory> -#include <mutex> -#include <optional> -#include <queue> -#include <thread> -#include <tuple> -#include <vector> - -namespace log4cxx { -class Logger; -typedef std::shared_ptr<Logger> LoggerPtr; -} // namespace log4cxx - -namespace hxcomm { - -/** - * Extoll connection class. - * Establish and hold Extoll connection to FPGA. - * Provide convenience functions for sending and receiving UT messages. - * @tparam ConnectionParameter UT message parameter for connection - */ -template <typename ConnectionParameter> -class ExtollConnection -{ -public: - HXCOMM_EXPOSE_MESSAGE_TYPES(ConnectionParameter) - - using init_parameters_type = typename std::tuple<RMA2_Nodeid>; - - static constexpr char name[] = "ExtollConnection"; - - typedef std::vector<receive_message_type> receive_queue_type; - - /** - * Create connection to FPGA via Extoll. - */ - ExtollConnection() SYMBOL_VISIBLE; - - /** - * Create connection to FPGA via Extoll for given Node ID. - */ - ExtollConnection(RMA2_Nodeid node_id) SYMBOL_VISIBLE; - - /** - * Copy constructor deleted. - */ - ExtollConnection(ExtollConnection const&) = delete; - - /** - * Assignment operator deleted. - */ - ExtollConnection& operator=(ExtollConnection const&) = delete; - - /** - * Move constructor. - */ - ExtollConnection(ExtollConnection&& other) SYMBOL_VISIBLE; - - /** - * Assignment operator. - */ - ExtollConnection& operator=(ExtollConnection&& other) SYMBOL_VISIBLE; - - /** - * Destruct connection to FPGA joining all receive threads. - */ - ~ExtollConnection() SYMBOL_VISIBLE; - - constexpr static std::initializer_list<hxcomm::Target> supported_targets = {Target::hardware}; - - /** - * Get time information. - * @return Time information - */ - ConnectionTimeInfo get_time_info() const SYMBOL_VISIBLE; - - /** - * Get unique identifier from hwdb. - * @param hwdb_path Optional path to hwdb - * @return Unique identifier - */ - std::string get_unique_identifier(std::optional<std::string> hwdb_path = std::nullopt) const - SYMBOL_VISIBLE; - - /** - * Get bitfile information. - * @return Bitfile info - */ - std::string get_bitfile_info() const SYMBOL_VISIBLE; - - /** - * Get server-side remote repository state information. - * Only non-empty for QuiggeldyConnection. - * @return Repository state - */ - std::string get_remote_repo_state() const SYMBOL_VISIBLE; - -private: - /** - * Registry of open ExtollConnections. - */ - typedef ConnectionRegistry<ExtollConnection> Registry; - std::unique_ptr<Registry> m_registry; - - friend Stream<ExtollConnection>; - /** - * Add a single UT message to the send queue. - * @param message Message to add - */ - void add(send_message_type const& message) SYMBOL_VISIBLE; - - /** - * Add multiple UT messages to the send queue. - * @tparam InputIterator Iterator type of sequence of messages to add - * @param begin Iterator to beginning of sequence - * @param end Iterator to end of sequence - */ - template <typename InputIterator> - void add(InputIterator const& begin, InputIterator const& end); - - /** - * Send messages in send queue. - * All messages in the send queue are guaranteed to be transferred. - */ - void commit() SYMBOL_VISIBLE; - - /** - * Receive all UT messages currently in the receive queue. - * @return Received messages - */ - receive_queue_type receive_all() SYMBOL_VISIBLE; - - /** - * Get whether the connection has no UT messages available to receive. - * @return Boolean value - */ - bool receive_empty() const SYMBOL_VISIBLE; - - /** - * Start execution and wait until halt instruction is received from FPGA. - */ - void run_until_halt() SYMBOL_VISIBLE; - - /** - * Get internal mutex to use for mutual exclusion. - * @return Mutable reference to mutex - */ - std::mutex& get_mutex() SYMBOL_VISIBLE; - - /** - * Check for bitfile version compatibility. - */ - void check_compatibility() const SYMBOL_VISIBLE; - - /** - * Numbers to compare against bitfile protocol version - * - * There are 5 scenarios (newer covers new changes as well as outdated partners) - * 1: Software is newer than biftile and still compatible - * 2: Software is newer than biftile but incompatible - * 3: FPGA bitfile is newer than software and still compatible - * 4: FPGA bitfile is newer than software but incompatible - * 5: Both are head - * - * The FPGA returns two numbers - * - version: Integer automatically incrementing with each change to the bitfile - * - compatible_until: Integer manually incrementing when bitfile introduces breaking feature - * - * We can now cover all 5 cases by comparing these two numbers as follows - * - oldest_supported_version: manually set to last known bitfile version with breaking change - * - newest_supported_compatible_until: identical to current head bitfile compatible_until - * - * oldest_supported_version needs to be lesser or equal to version and - * newest_supported_compatible_until needs to be greater or equal to compatible_until - * Cases 1, 3 and 5 fulfill these conditions whereas 2 and 4 do not - */ - static constexpr size_t oldest_supported_version = 0; - static constexpr size_t newest_supported_compatible_until = - bss_hw_params::cube_extoll::bitfile_compatible_until; - - std::unique_ptr<nhtl_extoll::Endpoint> m_connection; - typedef typename ConnectionParameter::Send::PhywordType subpacket_type; - - static_assert( - std::is_same<subpacket_type, typename ConnectionParameter::Send::PhywordType>::value, - "subpacket_type does not match send PhyWord type."); - static_assert( - std::is_same<subpacket_type, typename ConnectionParameter::Receive::PhywordType>::value, - "subpacket_type does not match receive PhyWord type."); - - struct SendQueue - { - public: - SendQueue(nhtl_extoll::Endpoint& connection); - - void push(subpacket_type const& subpacket); - - void flush(); - - size_t cum_size(); - - private: - nhtl_extoll::Endpoint& m_connection; - size_t m_packets; - size_t m_cum_packets; - }; - - typedef SendQueue send_queue_type; - send_queue_type m_send_queue; - - typedef Encoder<typename ConnectionParameter::Send, send_queue_type> encoder_type; - encoder_type m_encoder; - - mutable std::mutex m_receive_queue_mutex; - receive_queue_type m_receive_queue; - - typedef ListenerHalt<UTMessage< - ConnectionParameter::Receive::HeaderAlignment, - typename ConnectionParameter::Receive::SubwordType, - typename ConnectionParameter::Receive::PhywordType, - typename ConnectionParameter::Receive::Dictionary, - typename ConnectionParameter::ReceiveHalt>> - listener_halt_type; - listener_halt_type m_listener_halt; - - typedef Decoder<typename ConnectionParameter::Receive, receive_queue_type, listener_halt_type> - decoder_type; - decoder_type m_decoder; - - std::atomic<bool> m_run_receive; - - log4cxx::LoggerPtr m_logger; - - void work_receive(); - std::thread m_worker_receive; - - std::mutex m_mutex; - - typedef std::atomic<std::chrono::nanoseconds::rep> duration_type; - duration_type m_encode_duration{}; - duration_type m_decode_duration{}; - duration_type m_commit_duration{}; - duration_type m_execution_duration{}; -}; - -} // namespace hxcomm - -#include "hxcomm/common/extollconnection.tcc" diff --git a/include/hxcomm/common/extollconnection.tcc b/include/hxcomm/common/extollconnection.tcc deleted file mode 100644 index f47fc12..0000000 --- a/include/hxcomm/common/extollconnection.tcc +++ /dev/null @@ -1,18 +0,0 @@ -#include "hate/timer.h" - -namespace hxcomm { - -template <typename ConnectionParameter> -template <typename InputIterator> -void ExtollConnection<ConnectionParameter>::add(InputIterator const& begin, InputIterator const& end) -{ - hate::Timer timer; - if (!m_connection) { - throw std::runtime_error("Unexpected access to moved-from ExtollConnection."); - } - m_encoder(begin, end); - auto const duration = timer.get_ns(); - m_encode_duration.fetch_add(duration, std::memory_order_relaxed); -} - -} // namespace hxcomm diff --git a/include/hxcomm/common/extollconnection_impl.tcc b/include/hxcomm/common/extollconnection_impl.tcc deleted file mode 100644 index 9033a4f..0000000 --- a/include/hxcomm/common/extollconnection_impl.tcc +++ /dev/null @@ -1,420 +0,0 @@ -#include "hate/math.h" -#include "hate/timer.h" -#include "hwdb4cpp/hwdb4cpp.h" -#include "hxcomm/common/logger.h" -#include "hxcomm/common/signal.h" -#include "nhtl-extoll/buffer.h" -#include "nhtl-extoll/configure_fpga.h" -#include <sched.h> -#include <yaml-cpp/yaml.h> - -#include <chrono> -#include <cstdint> -#include <cstring> - -namespace hxcomm { - -template <typename ConnectionParameter> -ExtollConnection<ConnectionParameter>::SendQueue::SendQueue(nhtl_extoll::Endpoint& connection) : - m_connection(connection), m_packets(), m_cum_packets() -{} - -template <typename ConnectionParameter> -void ExtollConnection<ConnectionParameter>::SendQueue::push(subpacket_type const& subpacket) -{ - m_connection.buffer.write_send(m_packets, subpacket); - m_packets++; - m_cum_packets++; - if (m_packets == m_connection.buffer.send_buffer_size_qw()) { - m_connection.rma_send(m_packets); - m_packets = 0; - } -} - -template <typename ConnectionParameter> -void ExtollConnection<ConnectionParameter>::SendQueue::flush() -{ - if (m_packets) { - m_connection.rma_send(m_packets); - m_packets = 0; - } - m_cum_packets = 0; -} - -template <typename ConnectionParameter> -size_t ExtollConnection<ConnectionParameter>::SendQueue::cum_size() -{ - return m_cum_packets; -} - -template <typename ConnectionParameter> -ExtollConnection<ConnectionParameter>::ExtollConnection() : - m_registry(std::make_unique<Registry>(std::tuple{nhtl_extoll::get_fpga_node_id()})), - m_connection(std::make_unique<nhtl_extoll::Endpoint>(std::get<0>(m_registry->m_parameters))), - m_send_queue(*m_connection), - m_encoder(m_send_queue), - m_receive_queue_mutex(), - m_receive_queue(), - m_listener_halt(), - m_decoder(m_receive_queue, m_listener_halt), - m_run_receive(true), - m_logger(log4cxx::Logger::getLogger("hxcomm.ExtollConnection")), - m_worker_receive(&ExtollConnection<ConnectionParameter>::work_receive, this) -{ - HXCOMM_LOG_DEBUG( - m_logger, "ExtollConnection(): establishing Extoll connection to node " + - std::to_string(nhtl_extoll::get_fpga_node_id()) + "."); - check_compatibility(); - nhtl_extoll::configure_fpga(*m_connection); - HXCOMM_LOG_DEBUG( - m_logger, "ExtollConnection(): Extoll connection established to node " + - std::to_string(nhtl_extoll::get_fpga_node_id()) + "."); -} - -template <typename ConnectionParameter> -ExtollConnection<ConnectionParameter>::ExtollConnection(RMA2_Nodeid node_id) : - m_registry(std::make_unique<Registry>(std::tuple{node_id})), - m_connection(std::make_unique<nhtl_extoll::Endpoint>(std::get<0>(m_registry->m_parameters))), - m_send_queue(*m_connection), - m_encoder(m_send_queue), - m_receive_queue_mutex(), - m_receive_queue(), - m_listener_halt(), - m_decoder(m_receive_queue, m_listener_halt), - m_run_receive(true), - m_logger(log4cxx::Logger::getLogger("hxcomm.ExtollConnection")), - m_worker_receive(&ExtollConnection<ConnectionParameter>::work_receive, this) -{ - HXCOMM_LOG_DEBUG( - m_logger, "ExtollConnection(): establishing Extoll connection to node with id " + - std::to_string(node_id) + "."); - check_compatibility(); - nhtl_extoll::configure_fpga(*m_connection); - HXCOMM_LOG_DEBUG( - m_logger, "ExtollConnection(): Extoll connection established to node with id " + - std::to_string(node_id) + "."); -} - -template <typename ConnectionParameter> -ExtollConnection<ConnectionParameter>::ExtollConnection(ExtollConnection&& other) : - m_registry(), - m_connection(), - m_send_queue(other.m_send_queue), - m_encoder(other.m_encoder, m_send_queue), - m_receive_queue_mutex(), - m_receive_queue(), - m_listener_halt(), - m_decoder(m_receive_queue, m_listener_halt), // temporary - m_run_receive(true), - m_logger(log4cxx::Logger::getLogger("hxcomm.ExtollConnection")), - m_worker_receive() -{ - HXCOMM_LOG_DEBUG( - m_logger, "ExtollConnection() [move]: start moving conn to " + - std::to_string(std::get<0>(other.m_registry->m_parameters)) + "."); - // shutdown other threads - other.m_run_receive = false; - other.m_worker_receive.join(); - m_encode_duration = other.m_encode_duration.load(std::memory_order_relaxed); - m_decode_duration = other.m_decode_duration.load(std::memory_order_relaxed); - m_commit_duration = other.m_commit_duration.load(std::memory_order_relaxed); - m_execution_duration = other.m_execution_duration.load(std::memory_order_relaxed); - // move registry - m_registry = std::move(other.m_registry); - // move nhtl-extoll endpoint - m_connection = std::move(other.m_connection); - // move queues - m_receive_queue.~receive_queue_type(); - new (&m_receive_queue) decltype(m_receive_queue)(std::move(other.m_receive_queue)); - // create decoder - m_decoder.~decoder_type(); - new (&m_decoder) decltype(m_decoder)(other.m_decoder, m_receive_queue, m_listener_halt); - // create and start threads - m_worker_receive = std::thread(&ExtollConnection<ConnectionParameter>::work_receive, this); - HXCOMM_LOG_DEBUG( - m_logger, "ExtollConnection() [move]: finished moving conn to " + - std::to_string(std::get<0>(other.m_registry->m_parameters)) + "."); -} - -template <typename ConnectionParameter> -ExtollConnection<ConnectionParameter>& ExtollConnection<ConnectionParameter>::operator=( - ExtollConnection&& other) -{ - if (&other != this) { - HXCOMM_LOG_DEBUG(m_logger, "ExtollConnection::operator=() [move]: start."); - // shutdown own threads - if (m_run_receive) { - m_run_receive = false; - m_worker_receive.join(); - } - m_run_receive = static_cast<bool>(other.m_run_receive); - // shutdown other threads - if (other.m_run_receive) { - other.m_run_receive = false; - other.m_worker_receive.join(); - } - m_encode_duration = other.m_encode_duration.load(std::memory_order_relaxed); - m_decode_duration = other.m_decode_duration.load(std::memory_order_relaxed); - m_commit_duration = other.m_commit_duration.load(std::memory_order_relaxed); - m_execution_duration = other.m_execution_duration.load(std::memory_order_relaxed); - // move registry - m_registry = std::move(other.m_registry); - // move nhtl-extoll endpoint - m_connection = std::move(other.m_connection); - // move queues - m_send_queue.~send_queue_type(); - new (&m_send_queue) send_queue_type(other.m_send_queue); - m_receive_queue.~receive_queue_type(); - new (&m_receive_queue) decltype(m_receive_queue)(std::move(other.m_receive_queue)); - // create decoder - m_decoder.~decoder_type(); - new (&m_decoder) decltype(m_decoder)(other.m_decoder, m_receive_queue, m_listener_halt); - // create encoder - m_encoder.~encoder_type(); - new (&m_encoder) encoder_type(other.m_encoder, m_send_queue); - // create and start thread - m_worker_receive = std::thread(&ExtollConnection<ConnectionParameter>::work_receive, this); - HXCOMM_LOG_DEBUG( - m_logger, "ExtollConnection::operator=() [move]: Extoll connection startup initiated."); - } - return *this; -} - -template <typename ConnectionParameter> -ExtollConnection<ConnectionParameter>::~ExtollConnection() -{ - HXCOMM_LOG_DEBUG(m_logger, "~ExtollConnection(): Stopping Extoll connection."); - m_run_receive = false; - if (m_worker_receive.joinable()) { - m_worker_receive.join(); - } - HXCOMM_LOG_DEBUG(m_logger, "~ExtollConnection(): Extoll connection stopped."); -} - -template <typename ConnectionParameter> -std::mutex& ExtollConnection<ConnectionParameter>::get_mutex() -{ - return m_mutex; -} - -template <typename ConnectionParameter> -void ExtollConnection<ConnectionParameter>::add(send_message_type const& message) -{ - hate::Timer timer; - if (!m_connection) { - throw std::runtime_error("Unexpected access to moved-from ExtollConnection."); - } - std::visit([this](auto const& m) { m_encoder(m); }, message); - auto const duration = timer.get_ns(); - m_encode_duration.fetch_add(duration, std::memory_order_relaxed); -} - -template <typename ConnectionParameter> -void ExtollConnection<ConnectionParameter>::commit() -{ - HXCOMM_LOG_DEBUG( - m_logger, "ExtollConnection::run_until_halt() on node_id " + - std::to_string(m_connection->get_node())); - - hate::Timer timer; - if (!m_connection) { - throw std::runtime_error("Unexpected access to moved-from ExtollConnection."); - } - m_encoder.flush(); - HXCOMM_LOG_DEBUG(m_logger, "commit(): Commiting " << m_send_queue.cum_size() << " word(s)."); - m_send_queue.flush(); - auto const duration = timer.get_ns(); - m_encode_duration.fetch_add(duration, std::memory_order_relaxed); - m_execution_duration.fetch_add(duration, std::memory_order_relaxed); -} - -template <typename ConnectionParameter> -typename ExtollConnection<ConnectionParameter>::receive_queue_type -ExtollConnection<ConnectionParameter>::receive_all() -{ - receive_queue_type all; - std::unique_lock<std::mutex> lock(m_receive_queue_mutex); - std::swap(all, m_receive_queue); - return all; -} - -template <typename ConnectionParameter> -void ExtollConnection<ConnectionParameter>::work_receive() -{ - HXCOMM_LOG_DEBUG(m_logger, "Pinning receiving thread to same CPU as polling thread."); - sched_setaffinity(0, sizeof(cpu_set_t), &(m_connection->poller.cpu)); - - using namespace std::literals::chrono_literals; - auto wait_period = 1us; - constexpr std::chrono::microseconds max_wait_period = 10ms; - - if (!m_connection) { - throw std::runtime_error("Unexpected access to moved-from ExtollConnection."); - } - - while (m_run_receive) { - auto const& data = m_connection->trace_ring_buffer.receive(); - - if (data.size() == 0) { - std::this_thread::sleep_for(wait_period); - wait_period = std::min(wait_period * 2, max_wait_period); - continue; - } - wait_period = 1us; - - HXCOMM_LOG_TRACE(m_logger, "Forwarding packet contents to decoder-coroutine.."); - hate::Timer timer; - { - std::unique_lock<std::mutex> lock(m_receive_queue_mutex); - m_decoder(data.begin(), data.end()); - } - m_decode_duration.fetch_add(timer.get_ns(), std::memory_order_release); - HXCOMM_LOG_TRACE(m_logger, "Forwarded packet contents to decoder-coroutine."); - } -} - -template <typename ConnectionParameter> -bool ExtollConnection<ConnectionParameter>::receive_empty() const -{ - std::unique_lock<std::mutex> lock(m_receive_queue_mutex); - return m_receive_queue.empty(); -} - -template <typename ConnectionParameter> -void ExtollConnection<ConnectionParameter>::run_until_halt() -{ - HXCOMM_LOG_DEBUG( - m_logger, "ExtollConnection::run_until_halt() on node_id " + - std::to_string(m_connection->get_node())); - - using namespace std::literals::chrono_literals; - hate::Timer timer; - if (!m_connection) { - throw std::runtime_error("Unexpected access to moved-from ExtollConnection."); - } - SignalOverrideIntTerm signal_override; - auto wait_period = 1us; - constexpr std::chrono::microseconds max_wait_period = 10ms; - while (!m_listener_halt.get()) { - std::this_thread::sleep_for(wait_period); - wait_period = std::min(wait_period * 2, max_wait_period); - } - m_listener_halt.reset(); - m_execution_duration += timer.get_ns(); -} - -template <typename ConnectionParameter> -ConnectionTimeInfo ExtollConnection<ConnectionParameter>::get_time_info() const -{ - return ConnectionTimeInfo{ - std::chrono::nanoseconds(m_encode_duration.load(std::memory_order_relaxed)), - std::chrono::nanoseconds(m_decode_duration.load(std::memory_order_acquire)), - std::chrono::nanoseconds(m_commit_duration.load(std::memory_order_relaxed)), - std::chrono::nanoseconds(m_execution_duration.load(std::memory_order_relaxed))}; -} - -template <typename ConnectionParameter> -std::string ExtollConnection<ConnectionParameter>::get_unique_identifier( - std::optional<std::string> hwdb_path) const -{ - if (!m_connection) { - throw std::runtime_error("Unexpected access to empty instance."); - } - RMA2_Nodeid const node_id = m_connection->get_node(); - - hwdb4cpp::database hwdb; - hwdb.load(hwdb_path ? *hwdb_path : hwdb4cpp::database::get_default_path()); - auto const hxcube_ids = hwdb.get_hxcube_ids(); - hwdb4cpp::HXCubeSetupEntry entry; - size_t fcp; - for (auto const id : hxcube_ids) { - auto const& local_entry = hwdb.get_hxcube_setup_entry(id); - for (auto const& [f, e] : local_entry.fpgas) { - if (!e.extoll_node_id) { - continue; - } - if (e.extoll_node_id == node_id) { - fcp = f; - entry = local_entry; - break; - } - } - } - if (!entry.fpgas.at(fcp).wing) { - throw std::runtime_error("No chip present."); - } - return entry.get_unique_branch_identifier( - entry.fpgas.at(fcp).wing.value().handwritten_chip_serial); -} - -template <typename ConnectionParameter> -std::string ExtollConnection<ConnectionParameter>::get_bitfile_info() const -{ - if (!m_connection) { - throw std::runtime_error("Unexpected access to empty instance."); - } - std::vector<uint64_t> bitfile_info_binary; - uint64_t current_bin; - int i; - - for (i = 0; i < 512; i++) { - current_bin = m_connection->rra_read(0x0 + i * 0x8); - bitfile_info_binary.push_back(current_bin); - // stop in case of reading a 0x0 QW to prevent reading beyond the memory size ! - // reading beyond the memory is an access to unknown address - // access to unknown addresses leads to an error-bit set in the RMA-packet header - // this error-bit leads to an error-notification interrupt in the kernel-driver - if (current_bin == 0) - break; - } - HXCOMM_LOG_DEBUG(m_logger, "get_bitfile_info(): read " << i << " QW of non-zero binary data."); - - std::vector<char> info_c_str; - for (size_t i = 0; i < bitfile_info_binary.size(); i++) { - for (size_t j = 0; j < sizeof(uint64_t); j++) { - char const my_char = (be64toh(bitfile_info_binary[i]) >> (j * sizeof(uint64_t))) & 0xff; - info_c_str.push_back(my_char); - } - } - return std::string(info_c_str.data()); -} - -template <typename ConnectionParameter> -std::string ExtollConnection<ConnectionParameter>::get_remote_repo_state() const -{ - return ""; -} - -template <typename ConnectionParameter> -void ExtollConnection<ConnectionParameter>::check_compatibility() const -{ - std::string const yaml = get_bitfile_info(); - if (yaml.empty()) { - throw std::runtime_error("Bitfile info empty"); - } - YAML::Node info = YAML::Load(yaml); - HXCOMM_LOG_DEBUG(m_logger, "check_compatibility(): bitfile info raw yaml:\n" << info); - - if (!(info["version"] && info["compatible_until"])) { - throw std::runtime_error("Cannot find version info in bitfile info"); - } - size_t const version = info["version"].as<size_t>(); - size_t const compat_until = info["compatible_until"].as<size_t>(); - if (version < oldest_supported_version) { - throw std::runtime_error( - "Bitfile protocol version " + std::to_string(version) + " too old. Must be at least " + - std::to_string(oldest_supported_version)); - } - if (compat_until > newest_supported_compatible_until) { - throw std::runtime_error( - "Software too old. Bitfile needs at least " + std::to_string(compat_until) + - ". Software only supports " + std::to_string(newest_supported_compatible_until)); - } - HXCOMM_LOG_INFO( - m_logger, "check_compatibility():\n\tFPGA:\tversion: " - << version << "\t compat_until: " << compat_until - << "\tSW:\tversion: " << oldest_supported_version - << "\t compat_until: " << newest_supported_compatible_until); -} - -} // namespace hxcomm diff --git a/include/hxcomm/common/fpga_ip_list.h b/include/hxcomm/common/fpga_ip_list.h index 88b6a39..a8c0123 100644 --- a/include/hxcomm/common/fpga_ip_list.h +++ b/include/hxcomm/common/fpga_ip_list.h @@ -1,8 +1,5 @@ #pragma once #include "hate/visibility.h" -#ifdef WITH_HXCOMM_EXTOLL -#include "rma2.h" -#endif #include <optional> #include <string> #include <vector> @@ -22,20 +19,4 @@ std::vector<std::string> get_fpga_ip_list() SYMBOL_VISIBLE; */ std::string get_fpga_ip() SYMBOL_VISIBLE; - -#ifdef WITH_HXCOMM_EXTOLL -/** - * Convert FPGA IP to Extoll Node ID - * @return RMA2_Nodeid - */ -std::optional<RMA2_Nodeid> convert_ip_to_extollid(std::string) SYMBOL_VISIBLE; - - -/** - * Convert list of FPGA IPs to list of Extoll Node IDs. - * @return Vector of RMA2_Nodeid - */ -std::vector<RMA2_Nodeid> convert_ips_to_extollids(std::vector<std::string>) SYMBOL_VISIBLE; -#endif // WITH_HXCOMM_EXTOLL - } // namespace hxcomm diff --git a/include/hxcomm/vx/connection_from_env.h b/include/hxcomm/vx/connection_from_env.h index 6d547e8..5db067f 100644 --- a/include/hxcomm/vx/connection_from_env.h +++ b/include/hxcomm/vx/connection_from_env.h @@ -12,7 +12,7 @@ namespace hxcomm::vx { * Automatically determine from environment what connection type to use and * return the corresponding variant. * - * Order of precedence is ZeroMockConnection > QuiggeldyConnection > Extoll-connected hardware > + * Order of precedence is ZeroMockConnection > QuiggeldyConnection > * HostARQ-connected hardware > CoSim right now if several are available. * * On the Python-side it is wrapped via ManagedConnection. diff --git a/include/hxcomm/vx/connection_variant.h b/include/hxcomm/vx/connection_variant.h index 62a5bb2..fbcba3b 100644 --- a/include/hxcomm/vx/connection_variant.h +++ b/include/hxcomm/vx/connection_variant.h @@ -4,9 +4,6 @@ #ifdef WITH_HXCOMM_HOSTARQ #include "hxcomm/vx/arqconnection.h" #endif -#ifdef WITH_HXCOMM_EXTOLL -#include "hxcomm/vx/extollconnection.h" -#endif #include "hxcomm/vx/quiggeldy_connection.h" #include "hxcomm/vx/simconnection.h" #include "hxcomm/vx/zeromockconnection.h" @@ -18,9 +15,6 @@ namespace hxcomm::vx { using ConnectionVariant = std::variant< #ifdef WITH_HXCOMM_HOSTARQ hxcomm::vx::ARQConnection, -#endif -#ifdef WITH_HXCOMM_EXTOLL - hxcomm::vx::ExtollConnection, #endif hxcomm::vx::SimConnection, hxcomm::vx::QuiggeldyConnection, diff --git a/include/hxcomm/vx/extollconnection.h b/include/hxcomm/vx/extollconnection.h deleted file mode 100644 index b21320f..0000000 --- a/include/hxcomm/vx/extollconnection.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "hxcomm/common/extollconnection.h" -#include "hxcomm/vx/connection_parameter.h" - -namespace hxcomm::vx { - -using ExtollConnection = hxcomm::ExtollConnection<ConnectionParameter>; - -} // namespace hxcomm::vx - -namespace hxcomm { - -extern template class SYMBOL_VISIBLE ExtollConnection<hxcomm::vx::ConnectionParameter>; -extern template class SYMBOL_VISIBLE ConnectionRegistry<hxcomm::vx::ExtollConnection>; - -} // namespace hxcomm \ No newline at end of file diff --git a/pyhxcomm/include/pyhxcomm/vx/extollconnection.h b/pyhxcomm/include/pyhxcomm/vx/extollconnection.h deleted file mode 100644 index 1bd967d..0000000 --- a/pyhxcomm/include/pyhxcomm/vx/extollconnection.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "hxcomm/vx/extollconnection.h" - -#include "pyhxcomm/common/managed_connection.h" -#include "pyhxcomm/vx/genpybind.h" - -namespace pyhxcomm::vx GENPYBIND_TAG_HXCOMM_VX { - -GENPYBIND_MANUAL({ - using ExtollConnection = ::hxcomm::vx::ExtollConnection; - - ::pyhxcomm::ManagedPyBind11Helper<ExtollConnection>( - parent, BOOST_HANA_STRING("ExtollConnection")); -}) - -} // namespace pyhxcomm::vx diff --git a/pyhxcomm/include/pyhxcomm/vx/python_bindings.h b/pyhxcomm/include/pyhxcomm/vx/python_bindings.h index 19995af..89dff71 100644 --- a/pyhxcomm/include/pyhxcomm/vx/python_bindings.h +++ b/pyhxcomm/include/pyhxcomm/vx/python_bindings.h @@ -5,9 +5,6 @@ #ifdef WITH_HXCOMM_HOSTARQ #include "pyhxcomm/vx/arqconnection.h" #endif -#ifdef WITH_HXCOMM_EXTOLL -#include "pyhxcomm/vx/extollconnection.h" -#endif #include "pyhxcomm/vx/quiggeldy_connection.h" #include "pyhxcomm/vx/simconnection.h" #include "pyhxcomm/vx/zeromockconnection.h" diff --git a/src/hxcomm/common/fpga_ip_list.cpp b/src/hxcomm/common/fpga_ip_list.cpp index 36cd4c9..0f69839 100644 --- a/src/hxcomm/common/fpga_ip_list.cpp +++ b/src/hxcomm/common/fpga_ip_list.cpp @@ -32,42 +32,4 @@ std::string get_fpga_ip() return ip_list.at(0); } -#ifdef WITH_HXCOMM_EXTOLL -std::optional<RMA2_Nodeid> convert_ip_to_extollid(std::string ip) -{ - std::optional<RMA2_Nodeid> id = std::nullopt; - - hwdb4cpp::database hwdb; - hwdb.load(hwdb4cpp::database::get_default_path()); - auto const hxcube_ids = hwdb.get_hxcube_ids(); - for (auto const cube_id : hxcube_ids) { - auto const& entry = hwdb.get_hxcube_setup_entry(cube_id); - for (auto const& [f, e] : entry.fpgas) { - if (e.ip.to_string() == ip) { - id = e.extoll_node_id; - break; - } - } - } - - return id; -} - -std::vector<RMA2_Nodeid> convert_ips_to_extollids(std::vector<std::string> ips) -{ - std::vector<RMA2_Nodeid> ids; - - for (auto ip : ips) { - auto id = convert_ip_to_extollid(ip); - if (id) { - ids.push_back(convert_ip_to_extollid(ip).value()); - } - } - if (ids.size() != ips.size()) { - throw std::runtime_error("Not all FPGA IPs have an associated Extoll-Node-ID"); - } - return ids; -} -#endif // WITH_HXCOMM_EXTOLL - } // namespace hxcomm diff --git a/src/hxcomm/vx/connection_from_env.cpp b/src/hxcomm/vx/connection_from_env.cpp index bc8b047..9b882a1 100644 --- a/src/hxcomm/vx/connection_from_env.cpp +++ b/src/hxcomm/vx/connection_from_env.cpp @@ -5,9 +5,6 @@ #include "hxcomm/vx/arqconnection.h" #endif #include "hxcomm/vx/connection_variant.h" -#ifdef WITH_HXCOMM_EXTOLL -#include "hxcomm/vx/extollconnection.h" -#endif #include "hxcomm/vx/quiggeldy_connection.h" #include "hxcomm/vx/simconnection.h" #include "hxcomm/vx/zeromockconnection.h" @@ -98,48 +95,6 @@ inline std::vector<ConnectionVariant> get_quiggeldyclient_list_from_env(std::opt return list; } -#ifdef WITH_HXCOMM_EXTOLL -inline std::vector<ConnectionVariant> get_extollconnection_list_from_env( - std::optional<size_t> limit = std::nullopt) -{ - auto fpga_ip_list = hxcomm::get_fpga_ip_list(); - - - std::vector<ConnectionVariant> connection_list; - char const* env_extoll = std::getenv("HXCOMM_USE_EXTOLL"); - if (env_extoll != nullptr && atoi(env_extoll)) { - if (fpga_ip_list.empty()) { - throw std::runtime_error("Found no FPGA Node licences in env!"); - } - if (limit && (fpga_ip_list.size() < *limit)) { - throw std::runtime_error( - "Found FPGA Node amount (" + std::to_string(fpga_ip_list.size()) + - ") lower than specified limit (" + std::to_string(*limit) + - ") in environment to connect to."); - } - - auto const available_nodes = nhtl_extoll::get_fpga_node_ids(); - - auto const nodes = hxcomm::convert_ips_to_extollids(fpga_ip_list); - - auto const num_nodes = (limit ? *limit : nodes.size()); - - connection_list.reserve(num_nodes); - - for (size_t i = 0; i < num_nodes; i++) { - if (std::find(available_nodes.begin(), available_nodes.end(), nodes.at(i)) != - available_nodes.end()) { - connection_list.emplace_back(std::in_place_type<ExtollConnection>, nodes.at(i)); - } else { - throw std::runtime_error( - "The node requested by the licence " + std::to_string(nodes.at(i)) + - " is not present in the network!"); - } - } - } - return connection_list; -} -#endif // WITH_HXCOMM_EXTOLL } // namespace detail std::vector<ConnectionVariant> get_connection_list_from_env(std::optional<size_t> limit) @@ -148,10 +103,6 @@ std::vector<ConnectionVariant> get_connection_list_from_env(std::optional<size_t return zeromock; } else if (auto qgc = detail::get_quiggeldyclient_list_from_env(limit); !qgc.empty()) { return qgc; -#ifdef WITH_HXCOMM_EXTOLL - } else if (auto ext = detail::get_extollconnection_list_from_env(limit); !ext.empty()) { - return ext; -#endif #ifdef WITH_HXCOMM_HOSTARQ } else if (auto arq = detail::get_arqconnection_list_from_env(limit); !arq.empty()) { return arq; diff --git a/src/hxcomm/vx/extollconnection.cpp b/src/hxcomm/vx/extollconnection.cpp deleted file mode 100644 index 05436ef..0000000 --- a/src/hxcomm/vx/extollconnection.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "hxcomm/vx/extollconnection.h" - -#include "hxcomm/common/connection_registry.tcc" -#include "hxcomm/common/extollconnection_impl.tcc" - -namespace hxcomm { - -template class ExtollConnection<hxcomm::vx::ConnectionParameter>; - -template class ConnectionRegistry<hxcomm::vx::ExtollConnection>; - -} // namespace hxcomm diff --git a/wscript b/wscript index 5042cd2..4863eef 100644 --- a/wscript +++ b/wscript @@ -13,9 +13,6 @@ def depends(dep): if getattr(dep.options, 'with_hxcomm_hostarq', True): dep('sctrltp') - if getattr(dep.options, 'with_hxcomm_extoll', True): - dep('nhtl-extoll') - dep('rant') dep('hate') dep('hwdb') @@ -69,9 +66,6 @@ def options(opt): hopts.add_withoption('hxcomm-hostarq', default=True, help='Toggle support for HostARQ-based connections') - hopts.add_withoption('hxcomm-extoll', default=True, - help='Toggle support for EXTOLL-based connections') - def configure(conf): conf.load('compiler_c') @@ -84,7 +78,6 @@ def configure(conf): conf.load("doxygen") conf.env.build_with_hostarq = conf.options.with_hxcomm_hostarq - conf.env.build_with_extoll = conf.options.with_hxcomm_extoll conf.env.DEFINES_HXCOMM = [ "HXCOMM_LOG_THRESHOLD=" + @@ -100,8 +93,6 @@ def configure(conf): ] if conf.env.build_with_hostarq: conf.env.DEFINES_HXCOMM.append('WITH_HXCOMM_HOSTARQ') - if conf.env.build_with_extoll: - conf.env.DEFINES_HXCOMM.append('WITH_HXCOMM_EXTOLL') conf.env.CXXFLAGS_HXCOMM = [ '-fvisibility=hidden', @@ -167,7 +158,6 @@ def build(bld): use_munge = ["MUNGE"] if bld.env.build_with_munge else [] use_hostarq = ["arqstream_obj"] if bld.env.build_with_hostarq else [] - use_extoll = ["nhtl_extoll"] if bld.env.build_with_extoll else [] bld(target = 'hxcomm_inc', export_includes = 'include' @@ -176,8 +166,6 @@ def build(bld): hxcomm_excludes = [] if not bld.env.build_with_hostarq: hxcomm_excludes.append('src/hxcomm/**/arqconnection.cpp') - if not bld.env.build_with_extoll: - hxcomm_excludes.append('src/hxcomm/**/extollconnection.cpp') bld.shlib( target = 'hxcomm', @@ -186,7 +174,7 @@ def build(bld): 'flange', 'rant', 'hate_inc', 'logger_obj', 'visions-slurm_inc', 'hwdb4cpp', 'YAMLCPP', 'bss-hw-params_inc', 'rcf-sf-only', 'rcf_extensions', - ] + use_munge + use_hostarq + use_extoll, + ] + use_munge + use_hostarq, uselib = 'HXCOMM', install_path = '${PREFIX}/lib', export_defines=bld.env.DEFINES_HXCOMM, -- GitLab