Libtorch move Variable from CPU to GPU Excessive CPU usage

(Zihua Xiong) #1
for (int k = 0; k < img_vars.size(); ++k) {
		
		img_var = img_vars[k]; //**vector of variable on CPU**
		if (use_gpu)                                
			img_var = img_var.cuda();//to(at::kCUDA);// **I find this code will Excessive CPU usage**
}

image

Is such a high CPU usage normal? and any way to reduce CPU usage?

(Will Feng) #2

Could you try setting OMP_NUM_THREADS=1, and see if there is still a high CPU usage?