I am trying to use A2C of StablesBaselines3 for training an agent on my custom environment. My problem is that my GPU Utilization is very less (around 10 % only) while my CPU utilization has hit the ceiling. Because of this the training is very very slow. I have tried the following things as per this discussion thread addressed by @araffin [https://github.com/hill-a/stable-baselines/issues/308]
- Expanding the Actor and Critic architecture to a three layer neural network having 256, 256 and 128 neurons respectively. The GPU utilization did increase after that but it was only marginal (increased from 10 % to 15 %) as in this suggestion
- changed
deviceargument of A2C method to 'cuda' from the default which is 'auto' - No improvement
It is not entirely clear what worked for the user in the above mentioned discussion. My A2C is intialized as follows:
import gym
from stable_baselines3 import A2C
policy_kwargs = dict(activation_fn=th.nn.ReLU,
net_arch=[dict(pi=[256, 256, 128], vf=[256, 256, 128])])
model = A2C("MlpPolicy", env, verbose=1, learning_rate=linear_schedule(0.001),\
n_steps=50, gamma=0.8, gae_lambda=1.0, ent_coef=0.2, vf_coef=0.2, \
tensorboard_log=logdir, policy_kwargs=policy_kwargs, seed=50, device='cuda' )
model.learn(total_timesteps=50000)
GPU configurations are:
- Cuda version - 9.0
- GPU - NVIDIA RTX 2080i
- GPU mem - 11GB (out of that only about 1600MB is being used)
CPU configurations
- Threads per Core - 2
- Core per socket - 8
- Intel i9 core 9900 K @ 3.6 Ghz
- CPU Mem - 32GB SW versions
- Torch - 1.6.0
- Tensorflow GPU - 2.4.1 (although I know SB3 implementation uses Torch)
- Python 3.7 on anaconda environment
Any help will be appreciated!