Repository navigation
Make the NRT stats counters optional. - #8235
Conversation
As title. They can be switched on/off with env var: `NUMBA_NRT_STATS`. Testing is updated to ensure that they are on when running CI/conda build test phase. Fixes numba#8156
b3c7d18 to
a73612b
Compare
gmarkall
left a comment
There was a problem hiding this comment.
The code changes look fine to me.
I have one query, which is about the use of the canary value for stats values when counting is disabled - wouldn't it be be safer / more Pythonic to raise a Python exception if the counter values are requested when counting is disabled? Presently the risk is that an invalid value is returned unnoticed - or, it needs to be checked for and dealt with anyway.
| int shutting; | ||
| /* Stats */ | ||
| std::atomic_size_t stats_alloc, stats_free, stats_mi_alloc, stats_mi_free; | ||
| struct { |
There was a problem hiding this comment.
The struct is a nice style improvement :-)
* Makes it such that querying NRT stats counters when they are disabled results in a RuntimeError. * Updates the Numba derived unittest TestCase to ensure that stats counters are on by default. * Adds tests for the stats counters API and more tests for the associated NUMBA_NRT_STATS environment variable. * Reverts changes to CI integrations setting the env var, the test suite handles this now.
|
/azp run (Checking if the test running issues are resolved) |
|
Command 'run
(Checking' is not supported by Azure Pipelines.
See additional documentation. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
From an OOB conversation, it was decided that the more Pythonic thing is to raise a Python exception if the counter values are requested when counting is disabled. This however would break the test suite out-of-the-box as there's a lot of tests that check for reference leaks and need the stats counters to be enabled. This is addressed by updating the test suite to enable the stats counters if the reference leak checking mixin is used, it also adds a new mixin to enable the stats counters as some tests use them for other purposes. |
gmarkall
left a comment
There was a problem hiding this comment.
Thanks for the updates - I think this now looks good. As agreed per OOB discussion, the best path is for the EnableNRTStatsMixin to always disable stats counters when it tears down - generally stats counters should be off, and any test that requires them should be using the mixin to make sure they're on - therefore the current state is most likely to catch any errors in the expectations of tests about the enablement of counters.
@esc / @stuartarchibald could this have a full buildfarm run please?
|
Buildfarm ID: |
Passed. |
As title. They can be switched on/off with env var:
NUMBA_NRT_STATS. Testing is updated to ensure that they are onwhen running CI/conda build test phase.
Fixes #8156
Depends on #8106, only the final patch (b3c7d18) is new.Rebased, dependency resolved, a73612b is b3c7d18.