Enable torch_trt and handle subprocess segfault in subprocess_worker (#754)
Summary:
This PR enables [torch_trt](https://github.com/NVIDIA/Torch-TensorRT) module on all the models.
Currently the library will segfault on some models, and the subprocess_worker needs to correctly handle that (otherwise, it will just hang forever because it is blocked by `os.read()` on a pipe whose input process is dead).
We introduce the following mechanism to handle subprocess segfault:
1. The `Pipe` class stores the pid of the child process if the pipe is reading from the child process.
2. When the pipe reads, it always creates a thread that periodically checks the status of the other process at the other end. If the other process dies or is in zombie status, the threads writes a special string, `_DEAD`, into the pipe, together with its exit code.
3. The main thread in the process checks the return message in the pipe, if it finds the `_DEAD` message, throw an exception, which is handled in `subprocess_worker`.
Pull Request resolved: https://github.com/pytorch/benchmark/pull/754
Reviewed By: robieta
Differential Revision: D34263322
Pulled By: xuzhao9
fbshipit-source-id: 59fc6858d3ea498c3137f406f7b3843f70316d83