Environment Vectorization Auto-Configuration
Advanced & Deep RL DS practice problem on Onlearn.
Difficulty: hard.
Topics: Understanding Dynamic Environment Parallelization, SubprocVecEnv initialization, OS-level process memory estimation, CPU affinity mapping, Asynchronous step execution, Resource-constrained scaling, Reinforcement Learning, Parallel Computing, Systems Architecture, Resource Management, Performance Optimization, Environment Vectorization, Memory Profiling, Parallel Process Management, Throughput Analysis, Hardware Constraints.
Implement an 'AutoVectorConfigurator' class that takes a target environment class and a memory limit in bytes. The class should determine the optimal number of vectorized environments (n envs) by simulating the memory footprint of a single environment instance and calculating the maximum number of instances that fit within 80% of the provided memory limit, while ensuring n envs is at least 1 and capped at the number of available physical CPU cores.