Closed cswinter closed 2 years ago
Braindump:
VecEnv
and push all parallelization into procgenpython deserialize.py
will print out the tilemapWW WWWWWWWWWWWWWWWWWWWWWW
WW WWWWWWWWWWWWWWWWWWWWWW
WW B GWWWWWWWWWWWWWWWWWWWWWW
WW WWWWWWWWWWWWWWWWWWWWWWWWWWWW
WW B WWWWWWWWWWWWWWWWWWWWWWWWWWWW
WW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
xWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
Getting good performance turned out to be a bit harder than I thought, the get_state
method turns out to be a bottleneck. I've eliminated some inefficiencies in the parsing, which gives a nice speedup, but still far from what Procgen is capable of. There's not further easy gains though without optimizing/parallelizing the get_state
method and Procgen serialization logic. Since get_state
isn't multithreaded afaik, using the in-built vectorized environment and parallelization doesn't really help, and so sticking with the current design where we have one single-env vectorized env for every environment and do parallelization on our side is both simpler and more performant.
Procgen also has it's own inbuilt parallelization which we can make use of. I'm not entirely sure how it works off the top of my head in terms of threads and CPU affinity. We should be able to either replace ParallelEnvs or EnvList and use the env parameter which I think is "num_envs".