QinbinLi / MOON

Model-Contrastive Federated Learning (CVPR 2021)
MIT License
263 stars 56 forks source link

CPU usage reaches 100%, while the GPU (NVIDIA GeForce RTX 3060) only uses 1.2GB of memory. #24

Open YANGTUOMAO opened 3 weeks ago

YANGTUOMAO commented 3 weeks ago

image image

Issue Description I have noticed that when running the program, the CPU usage reaches 100%, while the GPU (NVIDIA GeForce RTX 3060) only uses 1.2GB of memory. Despite specifying the device as cuda:0 in the command, it seems that the program is still utilizing the CPU for computation.

Environment Information Operating System: Windows 11 Python Version: 3.x (please replace with the actual version) Running Environment: Using a virtual environment (e.g., Anaconda) Solutions Attempted Ensured that the device is correctly specified as cuda:0. Verified that CUDA and PyTorch are properly installed. I am a beginner in federated learning and would appreciate any further suggestions or possible solutions. Thank you!

QinbinLi commented 3 weeks ago

Hi @YANGTUOMAO ,

I haven't tested the code in Windows, and I'm not familiar with running pytorch on Windows. I'm not sure whether cuda:0 is your 3060 GPU. Maybe you can try cuda:1. Also, you may check whether there is a clear difference on the GPU memory usage before and after running the program. Our code still performs some computations on CPUs and high CPU utilization may be normal.

YANGTUOMAO commented 2 weeks ago

I have test this project on the A100 server of my #lab, with some changes in conf. It works fine, thx

你好@YANGTUOMAO,

我还没有在Windows上测试过代码,而且我不熟悉Windows上运行pytorch。我不确定cuda:0是否是你的3060 GPU。也许你可以尝试cuda:1。另外,你可以检查运行程序的GPU内存使用情况情况是否有明显差异。我们的代码仍然在CPU上执行一些计算,高CPU利用率可能是正常的。