FLAMEGPU / FLAMEGPU2

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

BugFix: MsgSpatial interaction radius correct when not a factor of en… #1160

Closed Robadob closed 6 months ago

Robadob commented 6 months ago

todo

Closes #1157

Robadob commented 6 months ago

I did run full test suite of a Debug build, just closed it without thinking to copy results.

Robadob commented 6 months ago

An extra global memory read is probably cheaper than a couple of fmodf's?

It's inside SEATBELTS, so perf doesn't matter.

On Wed, 13 Dec 2023 at 12:53, Peter Heywood @.***> wrote:

@.**** commented on this pull request.

In include/flamegpu/runtime/messaging/MessageSpatial2D/MessageSpatial2DDevice.cuh https://github.com/FLAMEGPU/FLAMEGPU2/pull/1160#discussion_r1425314714:

@@ -500,6 +500,13 @@ class MessageSpatial2D::In { // Return iterator at min corner of env, this should be safe return WrapFilter(metadata, metadata->min[0], metadata->min[1]); }

  • if (fmodf(metadata->max[0] - metadata->min[0], metadata->radius) > 0.00001f ||

I agree that hurting wrapped more and not hurting non-wrapped is the better choice.

Given the radii and width are known on the host, we could maybe do the check there once, and then set a value on the device somewhere marking if wrapped is possioble for that message list or not? for less perf loss to wrapped usage. An extra global memory read is probably cheaper than a couple of fmodf's?

Could do it entirley on the host if we made wrapped opt-in on the message list, but I assume that's not desirable?

Not sure there's a better option than fmodf, jsut the particular epsilon might need some thought / broader testing.

— Reply to this email directly, view it on GitHub https://github.com/FLAMEGPU/FLAMEGPU2/pull/1160#discussion_r1425314714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVGCQ25R2JNNNFQGAM2GDYJGQNZAVCNFSM6AAAAABARVOMGCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTONZZGU3TKNRTGI . You are receiving this because you authored the thread.Message ID: @.***>