2.6 Asynchronous Execution of Karamba3D Components

Asynchronous (Async) execution in Grasshopper refers to the ability of components to process data independently and concurrently without blocking the main computational thread. In the traditional, synchronous execution model of Grasshopper, each component computes its outputs sequentially, requiring all upstream components to complete their computations before downstream components can begin. This can result in delays and inefficiencies, particularly when dealing with computationally intensive tasks.

In Karamba3D, asynchronous execution can be toggled via the Karamba3D menu under "Settings > Async Execution". By default, this option is disabled.

Karamba3D's asynchronous components leverage the GrasshopperAsyncComponent framework, developed by Speckle Systems. This architecture divides the execution process of async components into two distinct stages:

  • Data Acquisition During this initial stage, no new computed data is output, which creates challenges for components that iteratively process portions of a Grasshopper definition, such as Galapagos. This limitation makes it necessary to disable async execution for Karamba3D components during looping or optimization runs.

  • Data Processing Once the required data is acquired, processing occurs independently, allowing for improved performance in certain contexts.

Disable async-execution when doing optimization runs (e.g. with Galapagos) or looping.

Async-Capable Components in Karamba3D

The following components in Karamba3D support asynchronous execution:

  • AssembleModel

  • All Algorithms components

  • ModelView, BeamView, and ShellView

  • LineResultsOnShells

  • MeshBreps

  • Shell Section

Features and Considerations

Async components in Karamba3D introduce key enhancements and options:

  • Improved Responsiveness Async components run parallel to the UI thread, preventing the interface from freezing during computation.

  • Context Menu Options Async-capable components include two additional entries in their context menu:

    • Cancel: Halts the component's execution while it is running.

    • Parallel Execution: Allows the component to process incoming data in parallel.

Caution on Parallel Execution

While parallel execution may enhance performance, Karamba3D's algorithms are already highly optimized for parallel processing. Activating an additional layer of parallelism via "Parallel Execution" in the context menu could result in over-parallelization, potentially causing performance degradation rather than improvement. Users are advised to enable this feature judiciously based on specific computational needs.

Last updated