Detectron2: RuntimeError: Not compiled with GPU support (ROIAlign_forward at /projectnb2/dnn-motion/shukai/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign.h:73)

Created on 7 Nov 2019  路  1Comment  路  Source: facebookresearch/detectron2

Do you know why we get the following error and how to fix it?

$ python -c 'import torch; from torch.utils.cpp_extension import CUDA_HOME; print(torch.cuda.is_available(), CUDA_HOME)'
True /share/pkg.7/cuda/10.1/install
[shukaif@scc-c09 detectron2]$ python demo/demo.py --config-file configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input input1.jpg input2.jpg  --opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
[11/06 18:23:06 detectron2]: Arguments: Namespace(confidence_threshold=0.5, config_file='configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml', input=['input1.jpg', 'input2.jpg'], opts=['MODEL.WEIGHTS', 'detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl'], output=None, video_input=None, webcam=False)
WARNING [11/06 18:23:06 d2.config.compat]: Config 'configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml' has no VERSION. Assuming it to be compatible with latest v2.
Traceback (most recent call last):
  File "demo/demo.py", line 83, in <module>
    predictions, visualized_output = demo.run_on_image(img)
  File "/projectnb2/dnn-motion/shukai/detectron2/demo/predictor.py", line 48, in run_on_image
    predictions = self.predictor(image)
  File "/share/pkg.7/pytorch/1.3/install/3.6/lib/python3.6/site-packages/torch/autograd/grad_mode.py", line 49, in decorate_no_grad
    return func(*args, **kwargs)
  File "/usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/engine/defaults.py", line 177, in __call__
    predictions = self.model([inputs])[0]
  File "/share/pkg.7/pytorch/1.3/install/3.6/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/modeling/meta_arch/rcnn.py", line 66, in forward
    return self.inference(batched_inputs)
  File "/usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/modeling/meta_arch/rcnn.py", line 124, in inference
    results, _ = self.roi_heads(images, features, proposals, None)
  File "/share/pkg.7/pytorch/1.3/install/3.6/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/modeling/roi_heads/roi_heads.py", line 568, in forward
    pred_instances = self._forward_box(features_list, proposals)
  File "/usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/modeling/roi_heads/roi_heads.py", line 615, in _forward_box
    box_features = self.box_pooler(features, [x.proposal_boxes for x in proposals])
  File "/share/pkg.7/pytorch/1.3/install/3.6/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/modeling/poolers.py", line 208, in forward
    output[inds] = pooler(x_level, pooler_fmt_boxes_level)
  File "/share/pkg.7/pytorch/1.3/install/3.6/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/layers/roi_align.py", line 95, in forward
    input, rois, self.output_size, self.spatial_scale, self.sampling_ratio, self.aligned
  File "/usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/layers/roi_align.py", line 20, in forward
    input, roi, spatial_scale, output_size[0], output_size[1], sampling_ratio, aligned
RuntimeError: Not compiled with GPU support (ROIAlign_forward at /projectnb2/dnn-motion/shukai/detectron2/detectron2/layers/csrc/ROIAlign/ROIAlign.h:73)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x33 (0x2abe4b592813 in /share/pkg.7/pytorch/1.3/install/3.6/lib/python3.6/site-packages/torch/lib/libc10.so)
frame #1: detectron2::ROIAlign_forward(at::Tensor const&, at::Tensor const&, float, int, int, int, bool) + 0x13d (0x2abe4ddfa81d in /usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/_C.cpython-36m-x86_64-linux-gnu.so)
frame #2: <unknown function> + 0x1ff0f (0x2abe4de09f0f in /usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/_C.cpython-36m-x86_64-linux-gnu.so)
frame #3: <unknown function> + 0x1fffe (0x2abe4de09ffe in /usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/_C.cpython-36m-x86_64-linux-gnu.so)
frame #4: <unknown function> + 0x1a8e5 (0x2abe4de048e5 in /usr4/cs640/shukaif/.local/lib/python3.6/site-packages/detectron2/_C.cpython-36m-x86_64-linux-gnu.so)
<omitting python frames>
frame #12: THPFunction_apply(_object*, _object*) + 0xa4f (0x2abdffc934af in /share/pkg.7/pytorch/1.3/install/3.6/lib/python3.6/site-packages/torch/lib/libtorch_python.so)

1) python3/3.6.5 2) opencv/4.0.1 3) gcc/5.5.0 4) cuda/10.1 5) pytorch/1.3

$ uname -a
Linux scc-c09 3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ /usr/local/etc/distro
centos7
$ python -m detectron2.utils.collect_env
---------------------  ------------------------------------------------------------------------------
sys.platform           linux
Python                 3.6.5 (default, Dec 12 2018, 17:12:39) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Numpy                  1.14.5
detectron2._C          failed to import
DETECTRON2_ENV_MODULE  <not set>
PyTorch                1.3.0
PyTorch Debug Build    False
torchvision            0.4.1
CUDA available         True
GPU 0                  Tesla P100-PCIE-12GB
CUDA_HOME              /share/pkg.7/cuda/10.1/install
NVCC                   Cuda compilation tools, release 10.1, V10.1.105
Pillow                 5.2.0
cv2                    4.0.1
---------------------  ------------------------------------------------------------------------------
PyTorch built with:
  - GCC 7.3
  - Intel(R) Math Kernel Library Version 2019.0.4 Product Build 20190411 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v0.20.5 (Git Hash 0125f28c61c1f822fd48570b4c1066f96fcb9b2e)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CUDA Runtime 10.1
  - NVCC architecture flags: -gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_50,code=compute_50
  - CuDNN 7.6.3
  - Magma 2.5.1
  - Build settings: BLAS=MKL, BUILD_NAMEDTENSOR=OFF, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -fopenmp -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Wno-stringop-overflow, DISABLE_NUMA=1, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=True, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, USE_STATIC_DISPATCH=OFF, 


[shukaif@scc-c09 detectron2]$ git log
commit eef3ab14c0777da7114e25689c703bb5d6094737
Author: Sam Pepose <[email protected]>
Date:   Fri Nov 1 12:58:58 2019 -0700

    Extended buffer support for file_io

    Summary:
    This adds the `buffering` param from Python built-in `open()` to `file_io`: https://docs.python.org/3/library/functions.html#open

    This allows the consumer of the API to specify how much should be buffered in-memory before being flushed to the raw resource.

    Reviewed By: theweiho, sujitoc

    Differential Revision: D18058123

    fbshipit-source-id: 8473887417092b5aa1f1f38d4c7a6d6cc3a608af

commit 944ff3b9080c061532c3b180cb6acc5f93a40940
Author: Yuxin Wu <[email protected]>
Date:   Fri Nov 1 01:46:41 2019 -0700

    fix docs (fix #202)

    Summary: Pull Request resolved: https://github.com/fairinternal/detectron2/pull/320

    Differential Revision: D18238515

    Pulled By: ppwwyyxx

    fbshipit-source-id: 680ae83b2df9fd7b996f2b271de0a95e98615d93

commit fd87af71eebc660dde2f50e4693869bb04f66015
Author: RaymondKirk <[email protected]>
Date:   Thu Oct 31 15:37:56 2019 -0700

    Initialise crop_gen in dataset mapper prior to tfm_gens so logs are c<E2><80><A6> (#207)

    Summary:
    <E2><80><A6>lear

    Before no evidence was in the logs that crop_gen would occur before.

invaliunrelated

>All comments

problem raised when I used PyTorch 1.1 for installation initially. Got a new clone of repo and installed with PyTorch 1.3 and everything is fixed now.

Was this page helpful?
0 / 5 - 0 ratings