NVIDIA / apex

A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch
BSD 3-Clause "New" or "Revised" License
8.16k stars 1.35k forks source link

Release GIL when calling C extensions #1814

Closed szmigacz closed 3 days ago

szmigacz commented 6 days ago

Extensions that aren't calling CPython API should release GIL to allow multithreading (e.g. to monitor execution progress and recover from hangs or crashes). PyTorch pybind bindings are already releasing GIL if possible (py::gil_scoped_release).