NVIDIA / apex

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

Release GIL when calling C extensions #1814

Closed szmigacz closed 4 months ago

szmigacz commented 5 months 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).