mmpose icon indicating copy to clipboard operation
mmpose copied to clipboard

Why mmpose utilizes all CPU processors by default when training in GPU mode?

Open August0424 opened this issue 4 years ago • 3 comments

I trained pose estimation model SimpleBaseLine on a single GPU, where I set the num_workers parameter in pytorch Dataloader to be 4, however, all the CPU cores in my computer were ocuppied. For a remote server, it may have more than 32 CPU cores. This results in the phenomenon that my GPU always waiting for a bunch of CPU cores, for there are too many CPU cores simultaniously working. Consequently, my GPU ulitity rate is relatively slow.

How to limit the number of CPU cores used of the whole training procedure? It seemed that the CPU computation was fairly dense, since every core worked to about 50%, which led to 50% usage of the whole CPU system. However, I read the source code, the loading, preprocessing and augmentation of raw data shouldn't have occupied so many CPU computation power. What are they working for?

August0424 avatar Oct 28 '21 05:10 August0424

I applied mixed precision training. Is this the main reason for the high CPU utility rate?

August0424 avatar Oct 28 '21 05:10 August0424

You may use CPUS_PER_TASK=2 to set the number of CPUs.

jin-s13 avatar Oct 29 '21 09:10 jin-s13

You may use CPUS_PER_TASK=2 to set the number of CPUs.

Do you mean that adding environment variable CPUS_PER_TASK in the training bash script? It seems that this doesn't help improve GPU utility in my case....

August0424 avatar Oct 29 '21 09:10 August0424