I am trying to update some code used in previous of pytorch (1.1 to 1.4) to 1.6. however, I am facing some errors.
The code has some pure cuda part needed, and some pytorch c++ wrapper around to communicate with the python code.
Here is the complete error trace :
(dumbass) lelouedec@lelouedec-phd:~/Desktop/GitSaving/cppattempt$ python setup.py install
running install
running bdist_egg
running egg_info
creating point.egg-info
writing point.egg-info/PKG-INFO
writing dependency_links to point.egg-info/dependency_links.txt
writing top-level names to point.egg-info/top_level.txt
writing manifest file 'point.egg-info/SOURCES.txt'
reading manifest file 'point.egg-info/SOURCES.txt'
writing manifest file 'point.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building 'point' extension
creating /home/lelouedec/Desktop/GitSaving/cppattempt/build
creating /home/lelouedec/Desktop/GitSaving/cppattempt/build/temp.linux-x86_64-3.7
Emitting ninja build file /home/lelouedec/Desktop/GitSaving/cppattempt/build/temp.linux-x86_64-3.7/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/3] c++ -MMD -MF /home/lelouedec/Desktop/GitSaving/cppattempt/build/temp.linux-x86_64-3.7/Point.o.d -pthread -B /home/lelouedec/anaconda3/envs/dumbass/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/TH -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.1/include -I/home/lelouedec/anaconda3/envs/dumbass/include/python3.7m -c -c /home/lelouedec/Desktop/GitSaving/cppattempt/Point.cpp -o /home/lelouedec/Desktop/GitSaving/cppattempt/build/temp.linux-x86_64-3.7/Point.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=point -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/ATen/Parallel.h:149:0,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/extension.h:4,
from /home/lelouedec/Desktop/GitSaving/cppattempt/Point.cpp:2:
/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/ATen/ParallelOpenMP.h:84:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for if ((end - begin) >= grain_size)
[2/3] c++ -MMD -MF /home/lelouedec/Desktop/GitSaving/cppattempt/build/temp.linux-x86_64-3.7/point_api.o.d -pthread -B /home/lelouedec/anaconda3/envs/dumbass/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/TH -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.1/include -I/home/lelouedec/anaconda3/envs/dumbass/include/python3.7m -c -c /home/lelouedec/Desktop/GitSaving/cppattempt/point_api.cpp -o /home/lelouedec/Desktop/GitSaving/cppattempt/build/temp.linux-x86_64-3.7/point_api.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=point -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/ATen/Parallel.h:149:0,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
from /home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/extension.h:4,
from /home/lelouedec/Desktop/GitSaving/cppattempt/point_api.cpp:2:
/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/ATen/ParallelOpenMP.h:84:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for if ((end - begin) >= grain_size)
[3/3] /usr/local/cuda-10.1/bin/nvcc -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/TH -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.1/include -I/home/lelouedec/anaconda3/envs/dumbass/include/python3.7m -c -c /home/lelouedec/Desktop/GitSaving/cppattempt/Point_cuda.cu -o /home/lelouedec/Desktop/GitSaving/cppattempt/build/temp.linux-x86_64-3.7/Point_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=point -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
FAILED: /home/lelouedec/Desktop/GitSaving/cppattempt/build/temp.linux-x86_64-3.7/Point_cuda.o
/usr/local/cuda-10.1/bin/nvcc -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/TH -I/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.1/include -I/home/lelouedec/anaconda3/envs/dumbass/include/python3.7m -c -c /home/lelouedec/Desktop/GitSaving/cppattempt/Point_cuda.cu -o /home/lelouedec/Desktop/GitSaving/cppattempt/build/temp.linux-x86_64-3.7/Point_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=point -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/ATen/record_function.h(18): warning: attribute "__visibility__" does not apply here
/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/include/ATen/record_function.h(18): warning: attribute "__visibility__" does not apply here
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28: required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5042:20: required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.h:5063:24: required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char16_t*; _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134: required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6688:95: required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char16_t; _Traits = std::char_traits<char16_t>; _Alloc = std::allocator<char16_t>]’ without object
__p->_M_set_sharable();
~~~~~~~~~^~
/usr/include/c++/7/bits/basic_string.tcc: In instantiation of ‘static std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits, _Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’:
/usr/include/c++/7/bits/basic_string.tcc:578:28: required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag) [with _FwdIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5042:20: required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct_aux(_InIterator, _InIterator, const _Alloc&, std::__false_type) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.h:5063:24: required from ‘static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with _InIterator = const char32_t*; _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’
/usr/include/c++/7/bits/basic_string.tcc:656:134: required from ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>::size_type, const _Alloc&) [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>; std::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]’
/usr/include/c++/7/bits/basic_string.h:6693:95: required from here
/usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_set_sharable() [with _CharT = char32_t; _Traits = std::char_traits<char32_t>; _Alloc = std::allocator<char32_t>]’ without object
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1515, in _run_ninja_build
env=env)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "setup.py", line 12, in <module>
cmdclass={'build_ext': BuildExtension})
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/setuptools/__init__.py", line 163, in setup
return distutils.core.setup(**attrs)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/setuptools/command/install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 175, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 161, in call_command
self.run_command(cmdname)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/command/install_lib.py", line 107, in build
self.run_command('build_ext')
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 87, in run
_build_ext.run(self)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 649, in build_extensions
build_ext.build_extensions(self)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions
self.build_extension(ext)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 208, in build_extension
_build_ext.build_extension(self, ext)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 478, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1233, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/home/lelouedec/anaconda3/envs/dumbass/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1529, in _run_ninja_build
raise RuntimeError(message)
RuntimeError: Error compiling objects for extension
I tried updating the code to remove warning from deprecated syntax but this is as far as I have been.
Any lead on this so I can find where to look at, as I am a bit lost if it is a code or compilation (libs etc… versions) problem.
Here is the setup.py file content :
from setuptools import setup, Extension
from torch.utils.cpp_extension import CppExtension, BuildExtension,CUDAExtension
setup(name='point',
ext_modules=[
CUDAExtension('point', [
'point_api.cpp',
'Point.cpp',
'Point_cuda.cu',
]),
],
cmdclass={'build_ext': BuildExtension})
Your faithfully
Justin