Is DGL NDArray thread safe?

Is the DGL NDArray class thread safe? Eg if one thread is writing to a NDArray’s data pointer, do I need to use a mutex to protect concurrent reads/writes?

I’m suspecting that NDArray is NOT thread safe, due to some concurrency bugs I’m running into during DGL C++ dev, but it’d be nice to get some confirmation from a DGL dev.


I don’t think it is thread safe. You will need a mutex to protect it.

1 Like