FLAMEGPU / FLAMEGPU2

FLAME GPU 2 is a GPU accelerated agent based modelling framework for CUDA C++ and Python
https://flamegpu.com
MIT License
105 stars 20 forks source link

change agent state in "FLAMEGPU_AGENT_FUNCTION" #1094

Closed chenyuyou closed 1 year ago

chenyuyou commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

Robadob commented 1 year ago

Could you be more specific? (You don't appear to have filled in the template)

It's currently possible for agents to optionally change from one predefined state to another via Agent Function Conditions.

Do you require arbitrary stage changes? (E.g. if an agent could move to one of many states decided in an agent function?)

chenyuyou commented 1 year ago

"I need to modify the agent state within the FLAMEGPU_AGENT_FUNCTION function. If I modify the agent state in the host function, the speed is significantly slower."

chenyuyou commented 1 year ago

I have another question. I wrote two programs with the same logic, one running in Mesa Python (AMD Ryzen 9 3900XT 12-Core Processor) and the other in FLAME GPU2(3070Ti). However, I found that there is not much difference in the running speed between the two. What should I do?

chenyuyou commented 1 year ago

Could you be more specific? (You don't appear to have filled in the template)

It's currently possible for agents to optionally change from one predefined state to another via Agent Function Conditions.

Do you require arbitrary stage changes? (E.g. if an agent could move to one of many states decided in an agent function?)

"I need to modify the agent state within the FLAMEGPU_AGENT_FUNCTION function. If I modify the agent state in the host function, the speed is significantly slower."

Robadob commented 1 year ago

I need to modify the agent state within the FLAMEGPU_AGENT_FUNCTION function. If I modify the agent state in the host function, the speed is significantly slower.

Is there a reason you are unable to use FLAMEGPU_AGENT_FUNCTION_CONDITION? These execute on the GPU, to decide whether agent's should change to a second state or not.

However, I found that there is not much difference in the running speed between the two.

At what scale (how many agents) are you running the model. Typically we expect GPU accelerated Agent based models (such as FLAMEGPU) to be faster than CPU modelling frameworks when the number of agents exceeds 20,000-100,000 agents (but it's very specific to the individual model, modelling framework and/or hardware).

I wouldn't recommend using FLAMEGPU if you are only dealing with a hundred or so agents. The latency of communication with the GPU would likely exceed the simulation time.

chenyuyou commented 1 year ago

thanks