Hi! I’m a still relatively new julia user and a completely fresh Agents.jl user.
For a bit of background, I’m working on a pretty simple model where the agents are independent and hence I was hoping to parallelize the code so that many agents can be worked on at once. I’ve read through the documentation and some issues on the github and unless I’m mistaken, while Agents.jl doesn’t do this in a simple manner (which makes sense), I do get the impression this is something that is done. So I would like to ask here to check that my understanding on how to do this is correct and for any tips.
Essentially, the impression I get is don’t use agent_step!
and instead implement the agent evolution in model_step!
where once can make a loop and parallelize it themselves. The first question I have is if there is any “best” way to do this, for example, at this point would it be recommended to make use of the scheduler or perhaps just to skip it? The naive thing that comes to my mind is:
@threads for agent in collect(allagents(model))
threadsafe_agent_step!(agent, model)
end
Does this use the scheduler of the model or not, if not is there a way to use it that is convenient and fast?
Perhaps however the most important, is there any quick reference on which functions from Agents.jl are thread safe themselves? In particular I would love to avoid having issues as these from which it seems clear adding/removing agents is not thread safe (perhaps unsurprisingly there). Are there any other function/things that should be avoided?
Thank you for any help on this!