High-performance asynchronous computation framework for system simulation

Overview

Asynchronix

A high-performance asynchronous computation framework for system simulation.

What is this?

Warning: this page is at the moment mostly addressed at interested contributors, but resources for users will be added soon.

In a nutshell, Asynchronix is an effort to develop a framework for discrete-event system simulation, with a particular focus on cyberphysical systems. In this context, a system might be something as large as a spacecraft, or as small as a IoT device.

Asynchronix draws from experience in the space industry but differs from existing tools in a number of respects, including:

  1. open-source license: it is distributed under the very permissive MIT and Apache 2 licenses, with the intent to foster an ecosystem where models can be easily exchanged without reliance on proprietary APIs,
  2. developer-friendly technology: Rust's support for algebraic types and its powerful type system make it ideal for the "cyber" part in cyberphysical, i.e. for modelling digital devices with state machines,
  3. very fast: by leveraging Rust's excellent support for multithreading and async programming, simulation models can run efficiently in parallel with all required synchronization being transparently handled by the simulator.

General design

Asynchronix is an async compute framework for time-based discrete event simulation.

From the perspective of simulation model implementers and users, it closely resembles a flow-based programming framework: a model is essentially an isolated entity with a fixed set of typed inputs and outputs, communicating with other models and with the scheduler through message passing. Unlike in conventional flow-based programming, however, request-response patterns are also possible.

Under the hood, Asynchronix' implementation is based on async Rust and the actor model. All inputs are forwarded to a single "mailbox" (an async channel), preserving the relative order of arrival of input messages.

Computations proceed at discrete times. When executed, models can post events for the future, i.e. request the delayed activation of an input. Whenever the computation at a given time completes, the scheduler selects the nearest future time at which one or several events are scheduled, thus triggering another set of computations.

This computational process makes it difficult to use general-purposes runtimes such as Tokio, because the end of a set of computations is technically a deadlock: the computation completes when all model have nothing left to do and are blocked on an empty mailbox. Also, instead of managing a conventional reactor, the runtime manages a priority queue containing the posted events. For these reasons, it was necessary for Asynchronix to develop a fully custom runtime.

Another crucial aspect of async compute is message-passing efficiency: oftentimes the processing of an input is a simple action, making inter-thread message-passing the bottleneck. This in turns calls for a very efficient channel implementation, heavily optimized for the case of starved receivers since models are most of the time waiting for an input to become available.

Current state

The simulator is rapidly approaching MVP completion and has achieved 2 major milestones:

  • completion of an extremely fast asynchronous multi-threaded channel, demonstrated in the Tachyonix project; this channel is the backbone of the actor model,
  • completion of a custom async executor optimized for message-passing and deadlock detection, which has demonstrated even better performance than Tokio for message-passing; this executor is already in the main branch and can be tested against other executors using the Tachyonix benchmark.

Before it becomes usable, however, further work is required to implement the priority queue, implement model inputs and outputs and adapt the channel.

License

This software is licensed under the Apache License, Version 2.0 or the MIT license, at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You might also like...
Rust in Anger: high-performance web applications

Rust in Anger: Book demo This is the code repository that accompanies the Rust in Anger blog post. The following folders each come with their own buil

High-performance Javascript color gradient library powered by Rust + WebAssembly

colorgrad-js High-performance Javascript color gradient library powered by Rust + WebAssembly. No dependencies. Faster than d3-scale, chroma-js, culor

Local-first high performance codebase index engine designed for AI

CodeIndex CodeIndex is a local-first high performance codebase index engine designed for AI. It helps your LLM understand the structure and semantics

Schemars is a high-performance Python serialization library, leveraging Rust and PyO3 for efficient handling of complex objects

Schemars Introduction Schemars is a Python package, written in Rust and leveraging PyO3, designed for efficient and flexible serialization of Python c

A high-performance web-based geospatial visualization tool with an emphasis LEO satellites and lunar missions.

A high-performance web-based geospatial visualization tool with an emphasis LEO satellites and lunar missions. Written in Rust to target WebGPU, with WebGL2 backwards compatibility.

Macchina - A system information frontend, with an (unhealthy) emphasis on performance.
Macchina - A system information frontend, with an (unhealthy) emphasis on performance.

macchina Fast, minimal and customizable system information frontend. Linux • macOS • Windows • NetBSD • FreeBSD • OpenWrt • Android About macchina let

An open source, programmed in rust, privacy focused tool for reading programming resources (like stackoverflow) fast, efficient and asynchronous from the terminal.

Falion An open source, programmed in rust, privacy focused tool for reading programming resources (like StackOverFlow) fast, efficient and asynchronou

Use asynchronous api requests in conjunction with yew's suspense feature

Yew API Hook Use asynchronous api requests in conjunction with yew's suspense feature Usage #[function_component] fn App() - Html { html! {

A fast, efficient osu! beatmap mirror written in asynchronous Rust

A fast, efficient osu! beatmap mirror written in asynchronous Rust. Supports cheesegull, aswell as osu!api v2 formats.

Owner
Asynchronics
Asynchronics
High-performance, low-level framework for composing flexible web integrations

High-performance, low-level framework for composing flexible web integrations. Used mainly as a dependency of `barter-rs` project

Barter 8 Dec 28, 2022
Incremental computation through constrained memoization.

comemo Incremental computation through constrained memoization. [dependencies] comemo = "0.1" A memoized function caches its return values so that it

Typst 37 Dec 15, 2022
Verifiable and confidential computation based on ZKP and FHE, powered by risc0 zkVM.

zkFHE Verifiable and confidential computation based on ZKP and FHE, powered by risc0 zkVM. A PoC to demonstrate an approach for private computation on

Emiliano Bonassi 29 Apr 25, 2023
Source code for our paper "Higher-order finite elements for embedded simulation"

Higher-order Finite Elements for Embedded Simulation This repository contains the source code used to produce the results for our paper: Longva, A., L

Interactive Computer Graphics 18 Sep 30, 2022
High-performance and normalised trading interface capable of executing across many financial venues

High-performance and normalised trading interface capable of executing across many financial venues. Also provides a feature rich simulated exchange to assist with backtesting and dry-trading.

Barter 7 Dec 28, 2022
A modern high-performance open source file analysis library for automating localization tasks

?? Filecount Filecount is a modern high-performance open source file analysis library for automating localization tasks. It enables you to add file an

Babblebase 4 Nov 11, 2022
High performance wlroots screen recording, featuring hardware encoding

wl-screenrec High performance wlroots based screen recorder. Uses dma-buf transfers to get surface, and uses the GPU to do both the pixel format conve

Russell Greene 32 Jan 21, 2023
A high-performance WebSocket integration library for streaming public market data. Used as a key dependency of the `barter-rs` project.

Barter-Data A high-performance WebSocket integration library for streaming public market data from leading cryptocurrency exchanges - batteries includ

Barter 23 Feb 3, 2023
A high-performance Rust library designed to seamlessly integrate with the Discord API.

Rucord - Rust Library for Discord API Interactions Note: This library is currently under development and is not yet recommended for production use. Ov

Coders' Collab 4 Feb 26, 2023
The Amp programming language: a language designed for building high performance systems.

A language designed for building high performance systems. Platform Support x86_64-pc-windows ✅ x86_64-unknown-linux ⚠️ untested x86_64-unknown-darwin

The Amp Programming Language 5 Mar 17, 2023