JuliaDynamics/Agents.jl

GPU Extensions to Agents.jl based on a different modelling approach

Open

#782 建立於 2023年3月14日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)Julia (904 star) (146 fork)batch import
hardhelp wantedparallelismperformance

描述

I developed a package for agent based modelling in continuum spaces of 1D, 2D and 3D.

dsb-lab/AgentBasedModels.jl

The features that it had over the current implementation of Agents.jl are:

  1. GPU compatible.
  2. Implemented continuum model integration methods as Euler, Heun or RungeKutta4.
  3. The possibility to define a continuum field coupled with the agents.
  4. Optimization methods specific for non-differentiable problems as agent-models.

Although the package is more specific purposed than Agents.jl. Talking with @Datseris, we agreed that it include interesting features and we could try to make it an extension or even a merge into Agents.jl.

On the compatibility with GPU

Since there are quite a lot of different topics, we can start talking about the GPU compatibility of Agents.

So far, Agents is arranged as:

  • Array of mutable structures (agents).
  • Model with the global parameters of the model

In order for Agents.jl to be compatible with CUDA.jl, it is required to transform this vision as:

  • Each parameter of an agent to become a CUDA.Array by itself.
  • Model may contain both global and local parameters.

This transformation will not need mutable structures that are incompatible with CUDA.jl and allow GPU kernels to work out.

On the way we define code in the other package

For allowing models to work in both CPU and GPU, my package uses macro programming to vectorize the code in the appropriate shape compatible to CPU and GPU. It will be interesting to discuss how we could make compatible Agents.jl way of defining stepping functions to allow for this flexibility.

貢獻者指南