KineticSim: 一种用于实时市场模拟器的轻量级高性能执行引擎
KineticSim: A Lightweight, High-Performance Execution Engine for Real-Time Market Simulators
AI总结:
针对传统CPU模拟器顺序处理瓶颈和GPU框架开销问题,提出持久化状态清除并行模式,在KineticSim中实现每秒547亿代理事件吞吐量,相比CPU加速3406倍,且内存占用更低。
摘要:
使用多智能体(基于代理)模型大规模模拟金融市场对于市场设计、监管压力测试和强化学习至关重要,但传统的CPU模拟器受限于顺序处理,而向量化的GPU框架则面临内核启动开销和冗余的全局内存往返。我们形式化、分析并评估了一种可复用的并行设计模式:用于迭代多智能体归约的持久化、状态携带的清除。通过将可变模拟状态缓存在跨步骤边界的线程块共享内存中,通过共享内存原子操作聚合代理动作,并协作解决清除函数,该模式将每步关键路径深度从顺序清除的Theta(L+A)(L个价格网格刻度,A个代理)降低到Theta(log L + ceil(A/L)),并使全局内存流量与步骤数无关。我们在KineticSim中实现了这一点,这是一个轻量级GPU执行引擎,可并行模拟大规模限价订单簿集合,达到每秒超过547亿个代理事件的峰值吞吐量。在固定工作负载下,它相比CPU(NumPy)实现了3406倍的加速,相比PyTorch GPU实现了27.8倍加速,相比JAX GPU实现了42.8倍加速,相比朴素的定制CUDA基线实现了8.4倍加速,同时使用的GPU内存大约比PyTorch少一个数量级。在53种配置中,两个定制CUDA引擎生成按位相同的订单簿,聚合统计信息与CPU参考值相差在0.1%以内。该模式可推广到其他需要状态持久化、块局部归约的迭代多智能体工作负载。
英文摘要:
Simulating financial markets at scale with multi-agent (Agent-Based) models is critical for market design, regulatory stress-testing, and reinforcement learning, but traditional CPU simulators are bottlenecked by sequential processing while vectorized GPU frameworks suffer from kernel-launch overhead and redundant global-memory round-trips. We formalize, analyze, and evaluate a reusable parallel design pattern: persistent, state-carrying clearing for iterative multi-agent reductions. By caching mutable simulation state in thread-block shared memory across step boundaries, aggregating agent actions via shared-memory atomics, and resolving the clearing function cooperatively, the pattern reduces the per-step critical-path depth from Theta(L+A) for sequential clearing (L price-grid ticks, A agents) to Theta(log L + ceil(A/L)) and makes global-memory traffic independent of the step count. We implement this in KineticSim, a lightweight GPU execution engine that simulates massive ensembles of limit-order books in parallel, reaching a peak throughput of over 54.7 billion agent-events per second. On a fixed workload it delivers speedups of 3406x over CPU (NumPy), 27.8x over PyTorch GPU, 42.8x over JAX GPU, and 8.4x over a naive custom CUDA baseline, while using roughly an order of magnitude less GPU memory than PyTorch. Across 53 configurations the two custom CUDA engines produce bitwise-identical order books, and aggregate statistics match the CPU reference to within 0.1%. The pattern generalizes to other iterative multi-agent workloads requiring state-persistent, block-localized reductions.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。