Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU and GPU memory consumption during inference #1170

Open
pkhigh opened this issue Aug 12, 2019 · 7 comments
Open

CPU and GPU memory consumption during inference #1170

pkhigh opened this issue Aug 12, 2019 · 7 comments
Labels
community help wanted Extra attention is needed

Comments

@pkhigh
Copy link

pkhigh commented Aug 12, 2019

DOUBT

While running the demo notebook for MaskRCNN model. I want to know why the script uses :

  1. Only 1.4 GB GPU memory ?
  2. 2.95 GB CPU memory ?
  3. The notebook loads more than 20 CPU threads ?
  4. Is there a way to control the total CPU threads and memory?

STEPS TO REPRODUCE

config_file = '../configs/mask_rcnn_r50_fpn_1x.py'
checkpoint_file = '../checkpoints/mask_rcnn_r50_fpn_2x_20181010-41d35c05.pth'
model = init_detector(config_file, checkpoint_file, device='cuda:0')
result = inference_detector(model, img)

@hellock
Copy link
Member

hellock commented Aug 13, 2019

The demo just process a single image, thus the memory should be small. Could you verify that the CPU threads are related to the jupyter notebook itself or mmdetection?

@pkhigh
Copy link
Author

pkhigh commented Aug 13, 2019

@hellock I created a python script and ran the model on 1000 images in a loop. I want to know why does the CPU memory consumption is 2.95 GB ? Yes all the threads are of mmdetection because I verfied by running it in .py script. Is there a way to control threads ?

@haikuoyao
Copy link

@hellock @pkhigh

I think I met a very similar issue.
#1571

Did you sort it out?

Thanks.

@haikuoyao
Copy link

haikuoyao commented Oct 22, 2019

Try torch.set_num_threads(1)

@hezhu1996
Copy link

@haikuoyao Hi, I have the same problem when training FasterRcnn. It uses a large amount of CPU and keep increasing. where do you add this "torch.set_num_threads(1)" in the code? thanks

@haikuoyao
Copy link

@TWDH I met in reference not in training.
So set in reference.py for torch

@solauky
Copy link

solauky commented Apr 4, 2021

@hellock Hi, I have the same problem when training MaskRCNN. It uses a large amount of CPU and keep increasing. How should deal with?Thank you~

@hhaAndroid hhaAndroid added the community help wanted Extra attention is needed label Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants