Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

infer with multi gpus #451

Closed
uefall opened this issue May 28, 2018 · 5 comments
Closed

infer with multi gpus #451

uefall opened this issue May 28, 2018 · 5 comments

Comments

@uefall
Copy link

uefall commented May 28, 2018

Hi:

I'm trying to use infer_simple.py to generate segmentation mask for a large number of imgs
but I don't know how to set multi gpu mode

if I change

cfg.NUM_GPUS = 1 --- > cfg.NUM_GPUS = 8

the demo still use gpu0 only

if I should change

with c2_utils.NamedCudaScope(0):

or some other configs?

@ir413
Copy link
Contributor

ir413 commented May 28, 2018

Hi @uefall, predictions for each image are computed using a single GPU. Detectron supports multi-gpu inference at the dataset level by splitting the datasets into cfg.NUM_GPUS chunks of images, each of which is handled by a single GPU (e.g. see this function). You can enable multi-gpu inference on datasets by specifying the multi-gpu-testing option in test_net and train_net tools. This option is not supported by infer and infer_simple tools at this time.

@MiZhangWhuer
Copy link

Hi @ir413, I have successfully complied caffe2 & Detectron under win7 platform, everything including python interface testing is OK except for multi-gpu inference. I tested the test_net.py on single GPU and it works, but when employing multi-gpu, it finally failed. I debug the scripts through PyCharm, and it indicates that some errors occurs on function p = subprocess.Popen in utils/subprocess.py.
After checking this function, I found that there isn't CUDA_VISIABLE_DEVICES envrionment variable in windows platform. So I comment this line " subprocess_env['CUDA_VISIBLE_DEVICES'] = str(gpu_ind)" in process_in_parallel function, but new issues occurs "AssertionError: Range subprocess failed (exit code: 1)
" (See snapshot)
rgb8rwrodmhqxo _extfqt1

How can I fix this error on windows platform? It seems that this error related to mutli-thread programming on python.

Our windows version link: https://github.com/MiZhangWhuer/Detectron-windows

Hope your reply.

@ir413
Copy link
Contributor

ir413 commented Oct 19, 2018

Hi @MiZhangWhuer, it seems that the issue with multi-gpu testing is specific to Windows. Unfortunately I don't have any experience with Windows so I don't have any concrete advice. Are you sure that it is not possible to set CUDA_VISIBLE_DEVICES on Windows? (I can't find anything about it here) Have you checked the subprocess.Popen docs to see if any of its Windows specific behavior is causing this issue?

@MiZhangWhuer
Copy link

@ir413 Thanks for your response. It may be the specific behavior on windows platform. I have tried several times, but still failed.
By the way, is there any example to do only semantic segmentation using Detectron framework? I notice that someone say they can training Mask-RCNN without RPN by employing StopGradient method. Is it possible for only semantic segmentation work?

@CasonTsai
Copy link

@ir413 does Detectron supports batch>1 inference with single gpu?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants