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

Tests: Increase robustness of context creation testing #1096

Closed ptheywood closed 11 months ago

ptheywood commented 11 months ago

To ensure that no cuda calls occur prior to device selection, an always run method in the test suite previously used timing and a cutoff threshold to make sure a new context was being established. This was quite flakey, as new driver updates could improve context creation times, requiring a lower threshold.

Instead, getting the current context via the driver api is used, and it should return null (or a cuda error) if no context yet exists. This should be a much more robust testing mechanism.

This is still created per run of the test suite, regardless of if the specific test is requested or not, which is wasted time if running with a filter (one more context creation than needed, so extra time).

We may wish to move this test to a separate ctest orcestrated test binary, to ensure it is the first to run (Google test has no way to enforce test order as a feature)


Tested on linux with CUDA 11.0 and 12.2 (12.2/driver 535 broke the old test on my 3060ti as context creation was too fast), and manually added a context creating call prior to applyConfig to ensure it will identify any errors that it is checking for.

Also removed a superfluos include.