Re:Growing open source from Torch to PyTorch
by anonymoushn on Friday August 06, 2021 @01:05AM
(#28083513)
People don't usually write the rules of a game or a MCTS to run on the GPU. They write it in Python, Lua, or C. If they write it in Python, then the GPU will idle all the time. If they write it in Lua or C then it will not.
Re:Growing open source from Torch to PyTorch
by dklend122 on Friday August 06, 2021 @09:04AM
(#28086587)
In Julia it's easy to run the entire thing on CUDA: https://github.com/fabricerosay/AlphaGPU
No C or any other language required because Julia has GPU codegen.
You can also keep MCTS on the CPU and be competitive with cpp despite the code being higher level, easier to read and more generic and composable. See: https://github.com/jonathan-laurent/AlphaZero.jl
While we were based on top of LuaJIT, we couldn't use the JIT for anything because we had to always call into the C library for GPU kernels (and LuaJIT can't JIT through an opaque C call, incase that C call changes the interpreter stack).
Where Python really helps is with its ecosystem. The entire data science and ML ecosystem is in Python.
The difficulty of calling out to C is not much greater in Python, things like PyBind11 make it pretty natural.