entity-neural-network / incubator

Collection of in-progress libraries for entity neural networks.
Apache License 2.0
29 stars 10 forks source link

Procgen wrapper #205

Closed cswinter closed 2 years ago

Bam4d commented 2 years ago

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".

cswinter commented 2 years ago

Braindump:

cswinter commented 2 years ago

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.

cswinter commented 2 years ago

Baselines: https://wandb.ai/entity-neural-network/enn-ppo/reports/Procgen-Baselines--VmlldzoxNzUxNDcy