daijifeng001 / MNC

Instance-aware Semantic Segmentation via Multi-task Network Cascades
Other
489 stars 182 forks source link

Errors when Building the Cython modules and the gpu_nms, gpu_mask_voting modules #1

Closed ethanhe42 closed 8 years ago

ethanhe42 commented 8 years ago

I can't figure out what's wrong. Any idea?

yihuihe ~ $ cd MNC/lib/
yihuihe (master) lib $ make
python setup.py build_ext --inplace
running build_ext
skipping 'utils/bbox.c' Cython extension (up-to-date)
building 'utils.cython_bbox' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/utils
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c utils/bbox.c -o build/temp.linux-x86_64-2.7/utils/bbox.o -Wno-cpp -Wno-unused-function
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/utils/bbox.o -o /home/yihuihe/MNC/lib/utils/cython_bbox.so
cythoning nms/cpu_nms.pyx to nms/cpu_nms.c
building 'nms.cpu_nms' extension
creating build/temp.linux-x86_64-2.7/nms
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c nms/cpu_nms.c -o build/temp.linux-x86_64-2.7/nms/cpu_nms.o -Wno-cpp -Wno-unused-function
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/nms/cpu_nms.o -o /home/yihuihe/MNC/lib/nms/cpu_nms.so
cythoning nms/gpu_nms.pyx to nms/gpu_nms.cpp
building 'nms.gpu_nms' extension
/usr/local/cuda/bin/nvcc -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python2.7 -c nms/nms_kernel.cu -o build/temp.linux-x86_64-2.7/nms/nms_kernel.o -arch=sm_35 --ptxas-options=-v -c --compiler-options '-fPIC'
ptxas info    : 0 bytes gmem
ptxas info    : Compiling entry function '_Z10nms_kernelifPKfPy' for 'sm_35'
ptxas info    : Function properties for _Z10nms_kernelifPKfPy
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 25 registers, 1280 bytes smem, 344 bytes cmem[0], 8 bytes cmem[2]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python2.7 -c nms/gpu_nms.cpp -o build/temp.linux-x86_64-2.7/nms/gpu_nms.o -Wno-unused-function
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from nms/gpu_nms.cpp:352:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^
c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/nms/nms_kernel.o build/temp.linux-x86_64-2.7/nms/gpu_nms.o -L/usr/local/cuda/lib64 -Wl,-R/usr/local/cuda/lib64 -lcudart -o /home/yihuihe/MNC/lib/nms/gpu_nms.so
cythoning nms/gpu_mv.pyx to nms/gpu_mv.cpp

Error compiling Cython file:
------------------------------------------------------------
...
cimport numpy as np

assert sizeof(int) == sizeof(np.int32_t)

cdef extern from "gpu_mv.hpp":
    void _mv(np.float32_t* all_boxes, np.float32_t* all_masks, np.int32_t all_boxes_num, np.int32_t* candidate_inds, np.int32_t* candidate_start, np.float32_t* candidate_weights, np.int32_t candidate_num, np.int32_t image_height, np.int32_t image_width, np.int32_t box_dim, np.int32_t mask_size, np.int32_t result_num, np.float32_t* result_mask, np.int32_t* result_box, np.int32_t device_id);
                                                                                                                                                                                                                                                                                                                                                                                                      ^
------------------------------------------------------------

nms/gpu_mv.pyx:8:391: Syntax error in C variable declaration
building 'nms.mv' extension
/usr/local/cuda/bin/nvcc -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python2.7 -c nms/mv_kernel.cu -o build/temp.linux-x86_64-2.7/nms/mv_kernel.o -arch=sm_35 --ptxas-options=-v -c --compiler-options '-fPIC'
ptxas info    : 0 bytes gmem
ptxas info    : Compiling entry function '_Z15reduce_mask_rowiPKfiiPb' for 'sm_35'
ptxas info    : Function properties for _Z15reduce_mask_rowiPKfiiPb
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 12 registers, 352 bytes cmem[0], 4 bytes cmem[2]
ptxas info    : Compiling entry function '_Z14mask_aggregateiPKfPfPKiS3_S0_ii' for 'sm_35'
ptxas info    : Function properties for _Z14mask_aggregateiPKfPfPKiS3_S0_ii
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 31 registers, 376 bytes cmem[0]
ptxas info    : Compiling entry function '_Z17reduce_bounding_yiPKbPii' for 'sm_35'
ptxas info    : Function properties for _Z17reduce_bounding_yiPKbPii
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 15 registers, 348 bytes cmem[0]
ptxas info    : Compiling entry function '_Z15reduce_mask_coliPKfiiPb' for 'sm_35'
ptxas info    : Function properties for _Z15reduce_mask_coliPKfiiPb
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 14 registers, 352 bytes cmem[0], 4 bytes cmem[2]
ptxas info    : Compiling entry function '_Z11mask_resizeiPKfPKiS2_Pfiii' for 'sm_35'
ptxas info    : Function properties for _Z11mask_resizeiPKfPKiS2_Pfiii
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 35 registers, 372 bytes cmem[0], 4 bytes cmem[2]
ptxas info    : Compiling entry function '_Z11mask_renderiPKfS0_iiiiPf' for 'sm_35'
ptxas info    : Function properties for _Z11mask_renderiPKfS0_iiiiPf
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 37 registers, 368 bytes cmem[0], 4 bytes cmem[2]
ptxas info    : Compiling entry function '_Z17reduce_bounding_xiPKbPii' for 'sm_35'
ptxas info    : Function properties for _Z17reduce_bounding_xiPKbPii
    0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info    : Used 15 registers, 348 bytes cmem[0]
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python2.7 -c nms/gpu_mv.cpp -o build/temp.linux-x86_64-2.7/nms/gpu_mv.o -Wno-unused-function
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
nms/gpu_mv.cpp:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
 #error Do not use this file, it is the result of a failed Cython compilation.
  ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
make: *** [all] Error 1
HaozhiQi commented 8 years ago

Hi,

I cannot reproduce this error. It compiles well both on my TitanX (with numpy version 1.10.4, cython version 0.23.4) and K40 (with numpy version 1.11.0, cython version 0.23.5) machine, with Ubuntu 14.04 and cuda7.5.

Could you give me some detailed information about your system settings? (like numpy and cython version).

ethanhe42 commented 8 years ago

Hi @Oh233 ,

yihuihe (master) lib $ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cython, numpy
>>> print cython.__version__, numpy.__version__
0.20.1post0 1.8.2

For GPU, I use Titan X

HaozhiQi commented 8 years ago

Hi,

Updating cython will solve this issue.

I tried with cython 0.20.1, the error occurs.

ethanhe42 commented 8 years ago

Thanks. Problem solved!

qinhaifangpku commented 8 years ago

@yihui-he i happend to this error, what cython version does it need? i am also output like this

print cython.version, numpy.version 0.20.1post0 1.8.2

ethanhe42 commented 8 years ago

@qinhaifangpku cython version 0.23.4, cython version 0.23.5