Ark.jl v0.4 focuses on bringing parallelization and customization to the core of the system. This major release introduces three powerful new features: seamless integration with all major GPU backends for component storage, the ability to use custom user-defined storages, and support for parallel queries.
Release highlights
GPU Storage
Here, it is possible to appreciate how in the new nbody demo the performance on a NVIDIA GeForce GTX 1650 is almost 20 times better than using all the 6 cores of my AMD Ryzen 5 5600H CPU:
| CPU N-Body | GPU N-Body |
|---|---|
This is made possible by the new GPUVector and GPUStructArray component storages. These utilize unified memory to allow for efficient mixed CPU/GPU operations, and are fully compatible with many major backends like CUDA.jl, Metal.jl, oneAPI.jl, and OpenCL.jl.
Custom Storages
Ark.jl now allows to easily plug any data structures into the ECS which implements the storage interface. As long as the new storage is a one-indexed subtype of AbstractVector and implements the interface, it can be used. For example, this flexibility allowed us to easily integrate UniqueVectors.jl to support components optimized for O(1) searches.
Parallel Queries
Queries in archetype‑based ECS are already highly efficient, but this release introduces the necessary tooling to support parallel queries for even greater performance. With this, one can run multiple queries simultaneously thanks to a thread-safe locking mechanism.
Benchmarks with Agents.jl
We also compared Ark.jl with Agents.jl by faithfully reimplementing the benchmarks at GitHub - JuliaDynamics/ABMFrameworksComparison: Benchmarks and comparisons of leading ABM frameworks. The results show that Ark.jl is 2-7x faster than Agents.jl on those! A result which surprised me a bit, since the way those benchmarks are structured don’t really allow for an ECS to shine too much. We lose instead pretty much in the LOCS category since currently no spatial facility is implemented for Ark.jl which was then needed to be recreated inline to run these benchmarks.
More
For a full list of all changes, see the CHANGELOG.
As always, your feedback contributions are highly appreciated!