Part of my project is written in C++, and I’m using pybind11 gil release/acquire functions to obtain multithreading in a section of my code that preprocesses single images of a dataset.
I wanted to know if it is safe to set num_workers=2
or greater in a DataLoader, because I have encountered a nasty random IndexError arising in the C++ code, which may hide a multithreading problem.
EDIT: I am also using a std::mutex
in the C++ code.