1

I'm running an heavy pytorch task on this VM(n1-standard, 2vCpu, 7.5 GB) and the statistics show that the cpu % is at 50%. On my PC(i7-8700) the cpu utilization is about 90/100% when I run this script (deep learning model). I don't understand if there is some limit for the n1-standard machine(I have read in the documentation that only the f1 obtain 20% of cpu usage and the g1 the 50%). Maybe if I increase the max cpu usage, my script runs faster. Is there any setting I should change?

mebius99
  • 2,495
  • 1
  • 5
  • 9
Nicola
  • 301
  • 3
  • 20
  • 1
    Is your task single-threaded? If it is, this could be explained by [this](https://stackoverflow.com/questions/53346844/google-cloud-compute-engine-cpu-usage-shows-100-but-dashboard-only-shows-10-us) as the 50% would mean that one of the two CPUs is used in full – siamsot Dec 15 '19 at 10:30
  • @siamsot, I think not because the same script on his PC use 8+ core. Can you share the PyTorch configuration? Maybe something in the initialization that don't take into account the virtualization of Compute Engine... Can you also perform a test on N1-standard-4 VM and tell us if the usage is about 25% or not? – guillaume blaquiere Dec 15 '19 at 12:48
  • @siamsot yes, you were right! I need to set the number of thread in pytorch, so it can use all the cpu! – Nicola Dec 15 '19 at 19:13
  • 1
    glad to hear! I added my hypothesis as an answer to make it easier for others to find – siamsot Dec 16 '19 at 00:03

1 Answers1

2

In this case, the task utilizes only one of the two processors that you have available so that's why you see only 50% of the CPU getting used.

If you allow pytorch to use all the CPUs of your VM by setting the number of threads, then it will see that the usage goes to 100%

siamsot
  • 1,501
  • 1
  • 14
  • 20