NVIDIA / apex

A PyTorch Extension: Tools for easy mixed precision and distributed training in Pytorch
BSD 3-Clause "New" or "Revised" License
8.31k stars 1.38k forks source link

RuntimeError: Error compiling objects for extension #1002

Open Faith-Code opened 3 years ago

Faith-Code commented 3 years ago

torch.version = 1.5.0 running install running bdist_egg running egg_info writing apex.egg-info/PKG-INFO writing dependency_links to apex.egg-info/dependency_links.txt writing top-level names to apex.egg-info/top_level.txt reading manifest file 'apex.egg-info/SOURCES.txt' writing manifest file 'apex.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py running build_ext building 'amp_C' extension Emitting ninja build file /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/build/temp.linux-x86_64-3.6/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/1] c++ -MMD -MF /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/build/temp.linux-x86_64-3.6/csrc/scale_check_overflow.o.d -pthread -B /home/qc/anaconda3/envs/rgbd/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include -I/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/TH -I/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/qc/anaconda3/envs/rgbd/include/python3.6m -c -c /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp -o /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/build/temp.linux-x86_64-3.6/csrc/scale_check_overflow.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=amp_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14 FAILED: /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/build/temp.linux-x86_64-3.6/csrc/scale_check_overflow.o c++ -MMD -MF /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/build/temp.linux-x86_64-3.6/csrc/scale_check_overflow.o.d -pthread -B /home/qc/anaconda3/envs/rgbd/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include -I/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/TH -I/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/qc/anaconda3/envs/rgbd/include/python3.6m -c -c /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp -o /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/build/temp.linux-x86_64-3.6/csrc/scale_check_overflow.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=amp_C -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++ /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp: In function ‘void scale_check_overflow(at::Tensor, float, at::Tensor, at::Tensor)’: /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:14:23: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations] AT_CHECK(grads.type().is_cuda(), "grads must be a CUDA tensor"); ^ In file included from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/Tensor.h:11:0, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/Context.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/ATen.h:5, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/extension.h:4, from /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:1: /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:262:30: note: declared here DeprecatedTypeProperties & type() const { ^~~~ /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:14:3: error: ‘AT_CHECK’ was not declared in this scope AT_CHECK(grads.type().is_cuda(), "grads must be a CUDA tensor"); ^~~~ /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:14:3: note: suggested alternative: ‘DCHECK’ AT_CHECK(grads.type().is_cuda(), "grads must be a CUDA tensor"); ^~~~ DCHECK /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:16:30: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations] AT_CHECK(overflow_buf.type().is_cuda(), "overflow_buf must be a CUDA tensor"); ^ In file included from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/Tensor.h:11:0, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/Context.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/ATen.h:5, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/extension.h:4, from /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:1: /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:262:30: note: declared here DeprecatedTypeProperties & type() const { ^~~~ /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:18:34: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations] AT_CHECK(downscaled_grads.type().is_cuda(), "downscaled_grads must be a CUDA tensor"); ^ In file included from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/Tensor.h:11:0, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/Context.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/ATen.h:5, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/extension.h:4, from /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:1: /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:262:30: note: declared here DeprecatedTypeProperties & type() const { ^~~~ /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:21:34: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations] AT_CHECK(downscaled_grads.type().scalarType() == at::ScalarType::Float, ^ In file included from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/Tensor.h:11:0, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/Context.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/ATen.h:5, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4, from /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/torch/extension.h:4, from /home/qc/PycharmProjects/RGBD_Semantic_Segmentation_PyTorch/furnace/apex/csrc/scale_check_overflow.cpp:1: /home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:262:30: note: declared here DeprecatedTypeProperties & type() const { ^~~~ ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1400, in _run_ninja_build check=True) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/subprocess.py", line 418, 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 77, in cmdclass=cmdclass, File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/setuptools/init.py", line 143, in setup return distutils.core.setup(**attrs) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/core.py", line 148, in setup dist.run_commands() File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/dist.py", line 955, in run_commands self.run_command(cmd) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/setuptools/command/install.py", line 67, in run self.do_egg_install() File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/setuptools/command/install.py", line 109, in do_egg_install self.run_command('bdist_egg') File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/setuptools/command/bdist_egg.py", line 172, in run cmd = self.call_command('install_lib', warn_dir=0) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command self.run_command(cmdname) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 78, in run _build_ext.run(self) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/command/build_ext.py", line 339, in run self.build_extensions() File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 580, in build_extensions build_ext.build_extensions(self) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions self.build_extension(ext) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 199, in build_extension _build_ext.build_extension(self, ext) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension depends=ext.depends) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 423, in unix_wrap_ninja_compile with_cuda=with_cuda) File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1140, in _write_ninja_file_and_compile_objects error_prefix='Error compiling objects for extension') File "/home/qc/anaconda3/envs/rgbd/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1413, in _run_ninja_build raise RuntimeError(message)

why???

crcrpar commented 3 years ago

What if ninja is disabled like this https://github.com/NVIDIA/apex/blob/5d9b5cbc2fb0e0e525c067723d66f1827440c7a8/setup.py#L287?

Qi-Chuan commented 3 years ago

hello, I have the same problem. Can you help me?

crcrpar commented 3 years ago

In what sense "the same problem"? Do you see some error in compiling some extension or building the RGBD_Semantic_Segmentation_PyTorch repository?

If latter, I found it so difficult because I can't tell which version or commit of apex does the repository uses. 😞

Qi-Chuan commented 3 years ago

In what sense "the same problem"? Do you see some error in compiling some extension or building the RGBD_Semantic_Segmentation_PyTorch repository?

If latter, I found it so difficult because I can't tell which version or commit of apex does the repository uses. 😞

Thanks a lot, I recompiled the extension and solved the problem.

Faith-Code commented 3 years ago

In what sense "the same problem"? Do you see some error in compiling some extension or building the RGBD_Semantic_Segmentation_PyTorch repository?

If latter, I found it so difficult because I can't tell which version or commit of apex does the repository uses. 😞

Thanks a lot, I changed the version of cuda and GCC and solved this problem.