题意:OpenAI Gym 和 Python 线程处理
问题背景:
I am working on a variation of A3C/ACER and I have several workers, each running on its own thread. I am using OpenAI gym environments.
我正在开发 A3C/ACER 的一个变体,并且有多个工作线程,每个线程都在独立运行。我使用的是 OpenAI Gym 环境。
Python threading works fine but it cannot fully utilize all cores. As there are no blocking I/O, it does not context switch.
Python 线程处理工作正常,但无法充分利用所有核心。由于没有阻塞的 I/O,它不会进行上下文切换
I would like workers to somehow to release the GIL while executing actions in their respective environments.
我希望工作线程在各自环境中执行操作时能够释放全局解释器锁(GIL)
I would appreciate your feedback: Does it make sense and it is possible?
我想听听你的反馈:这样做有意义吗?这是可行的吗?
问题解决:
Answering my own question: I found that a quite efficient way is demonstrated in OpenAI universe-starter-agent: GitHub - openai/universe-starter-agent: A starter agent that can solve a number of universe environments.
回答我自己的问题:我发现一个非常有效的方法展示在 OpenAI 的 universe-starter-agent 中:GitHub - openai/universe-starter-agent:一个能够解决多个 Universe 环境的入门代理。
The implementation uses Tensorflow and runs independent processes including a parameter server.
该实现使用 TensorFlow 并运行独立的进程,包括一个参数服务器
I think this can be useful as a reference to other people too.
我认为这对其他人也可以作为一个有用的参考。