chengdazhi / Deformable-Convolution-V2-PyTorch

Deformable ConvNets V2 (DCNv2) in PyTorch
MIT License
1.45k stars 230 forks source link

deform_conv_cuda_kernel.cu(71): error: namespace "std" has no member "min" #21

Open Simpatech-app opened 5 years ago

Simpatech-app commented 5 years ago

Hello Thanks for your implementation. I am trying to build your code, however I got errors in the beginning of make.

deform_conv_cuda_kernel.cu(71): error: namespace "std" has no member "min"

1 error detected in the compilation of "/tmp/tmpxft_00005005_00000000-6_deform_conv_cuda_kernel.cpp1.ii". but the building goes further: generating /tmp/tmpxh9mevss/_deform_conv.c setting the current directory to '/tmp/tmpxh9mevss' running build_ext building '_deform_conv' extension creating home creating home/miki creating home/miki/wd creating home/miki/wd/Deformable-Convolution-V2-PyTorch-master creating home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/miki/.conda/envs/py36/include/python3.6m -c _deform_conv.c -o ./_deform_conv.o -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/miki/.conda/envs/py36/include/python3.6m -c /home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/deform_conv.c -o ./home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/deform_conv.o -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/miki/.conda/envs/py36/include/python3.6m -c /home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/deform_conv_cuda.c -o ./home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/deform_conv_cuda.o -std=c++11 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -shared -B /home/miki/.conda/envs/py36/compiler_compat -L/home/miki/.conda/envs/py36/lib -Wl,-rpath=/home/miki/.conda/envs/py36/lib -Wl,--no-as-needed -Wl,--sysroot=/ ./_deform_conv.o ./home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/deform_conv.o ./home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/deform_conv_cuda.o /home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/deform_conv_cuda_kernel.cu.so -o ./_deform_conv.so gcc: error: /home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/deform_conv_cuda_kernel.cu.so: No such file or directory Traceback (most recent call last): File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/unixccompiler.py", line 197, in link self.spawn(linker + ld_args) File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/ccompiler.py", line 909, in spawn spawn(cmd, dry_run=self.dry_run) File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/spawn.py", line 36, in spawn _spawn_posix(cmd, search_path, dry_run=dry_run) File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/spawn.py", line 159, in _spawn_posix % (cmd, exit_status)) distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

**During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/miki/.conda/envs/py36/lib/python3.6/site-packages/cffi/ffiplatform.py", line 51, in _build dist.run_command('build_ext')** File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/command/build_ext.py", line 339, in run self.build_extensions() File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/command/build_ext.py", line 558, in build_extension target_lang=language) File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/ccompiler.py", line 717, in link_shared_object extra_preargs, extra_postargs, build_temp, target_lang) File "/home/miki/.conda/envs/py36/lib/python3.6/distutils/unixccompiler.py", line 199, in link raise LinkError(msg) distutils.errors.LinkError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "build.py", line 36, in ffi.build() File "/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/init.py", line 184, in build _build_extension(ffi, cffi_wrapper_name, target_dir, verbose) File "/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/init.py", line 108, in _build_extension outfile = ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname) File "/home/miki/.conda/envs/py36/lib/python3.6/site-packages/cffi/api.py", line 697, in compile compiler_verbose=verbose, debug=debug, **kwds) File "/home/miki/.conda/envs/py36/lib/python3.6/site-packages/cffi/recompiler.py", line 1520, in recompile compiler_verbose, debug) File "/home/miki/.conda/envs/py36/lib/python3.6/site-packages/cffi/ffiplatform.py", line 22, in compile outputfilename = _build(tmpdir, ext, compiler_verbose, debug) File "/home/miki/.conda/envs/py36/lib/python3.6/site-packages/cffi/ffiplatform.py", line 58, in _build raise VerificationError('%s: %s' % (e.class.name, e)) cffi.error.VerificationError: LinkError: command 'gcc' failed with exit status 1 Including CUDA code. /home/miki/wd/Deformable-Convolution-V2-PyTorch-master generating /tmp/tmp3tjxf2n0/_modulated_dcn.c setting the current directory to '/tmp/tmp3tjxf2n0' running build_ext building '_modulated_dcn' extension creating home creating home/miki creating home/miki/wd creating home/miki/wd/Deformable-Convolution-V2-PyTorch-master creating home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src gcc -pthread -B /home/miki/.conda/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/miki/.conda/envs/py36/include/python3.6m -c _modulated_dcn.c -o ./_modulated_dcn.o -fopenmp -std=c99 gcc -pthread -B /home/miki/.conda/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/miki/.conda/envs/py36/include/python3.6m -c /home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/modulated_dcn.c -o ./home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/modulated_dcn.o -fopenmp -std=c99 gcc -pthread -B /home/miki/.conda/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/miki/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/miki/.conda/envs/py36/include/python3.6m -c /home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/modulated_dcn_cuda.c -o ./home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/modulated_dcn_cuda.o -fopenmp -std=c99 gcc -pthread -shared -B /home/miki/.conda/envs/py36/compiler_compat -L/home/miki/.conda/envs/py36/lib -Wl,-rpath=/home/miki/.conda/envs/py36/lib -Wl,--no-as-needed -Wl,--sysroot=/ ./_modulated_dcn.o ./home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/modulated_dcn.o ./home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/modulated_dcn_cuda.o /home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/cuda/modulated_deform_im2col_cuda.cu.so /home/miki/wd/Deformable-Convolution-V2-PyTorch-master/src/cuda/deform_psroi_pooling_cuda.cu.so -o ./_modulated_dcn.so

as I mentioned the building continues and then I tried the test.py and test_modulated.py and I got the error for: No module named '_ext.deform_conv._deform_conv' I appriciate your guide. Thanks

notagenius commented 5 years ago

add

#include <algorithm>

to src/deform_conv_cuda_kernel.cu

Simpatech-app commented 5 years ago

Thanks for your guide @notagenius it is working now.