Skip to content

[Bug]: HostAPI empty sort throws an exception #1362

@Robadob

Description

@Robadob

Bug Description

Carlos has found that if the below code is called when there are no agents, a CUDA invalid configuration exception will be raised.

To Reproduce

cell_agent = FLAMEGPU.agent("CELL") # agent list must be empty
cell_agent.sortInt("id", pyflamegpu.HostAgentAPI.Asc)

Raises

File "C:\Users\PC\anaconda3\envs\flamegpu_py310\lib\site-packages\pyflamegpu\pyflamegpu.py", line 14017, in sortInt
    return _pyflamegpu.HostAgentAPI_sortInt(self, *args)
pyflamegpu.pyflamegpu.FLAMEGPURuntimeException: (CUDAError) D:/a/FLAMEGPU2/FLAMEGPU2/include\flamegpu/simulation/detail/CUDAErrorChecking.cuh(28): CUDA Error: D:\a\FLAMEGPU2\FLAMEGPU2\src\flamegpu\simulation\detail\CUDAScatter.cu(218): cudaErrorInvalidConfiguration invalid configuration argument

Expected Behaviour

It should be a null-op, notice empty and skip the sort.

OS

No response

CUDA Versions

No response

GPUs

No response

GPU Driver

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions