chore: move array definitions inside test functions in test_1490_jax_reducers_combinations.py#3829
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
|
The documentation preview is ready to be viewed at http://preview.awkward-array.org.s3-website.us-east-1.amazonaws.com/PR3829 |
The high-level arrays are "kinda" mutable when it comes to Well awkward is not thread-safe in the same sense that numpy is not thread-safe. You can have multiple threads modifying a buffer and there are no locks inside numpy protecting you. The python part of awkward should be thread safe but that doesn't mean you should share arrays between threads and start doing in place mutations to the buffers. Also the issue may be from jax here. I don't think you should spawn threads that do stuff to the same jax buffer either. We hit the error when we tried to get the Awkward is thread safe in the sense that you can spawn multiple python threads running awkward code without a problem. That's what we test in the test with |
In #3816 (comment), we encountered a failure during multi-threaded testing that went away with a re-run.
We hit this error in jax https://github.com/jax-ml/jax/blob/0d34e25aecf6466f9014186a2175f56f52106163/jax/_src/array.py#L498-L502
in
pytest-run-parallel, things defined at module level are shared among threads (and therefore those arrays are too).In case there is a mutable state somewhere, it's best to define arrays inside the test functions so that they are not shared among threads. We do just that here.