Hi all,
I downloaded the op files to the local files(named sdemodels_op_diy), and occurred an error when i import sdemodels_op_diy . I found the crucial reason is that the upfirn2d.py file used the cpp_extension function, namely, got same error when run the upfirn2d.py in pycharm. However, I did not fix it.
import sdemodels_op_diy
Traceback (most recent call last):
File "/home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1893, in _run_ninja_build
subprocess.run(
File "/home/hwtan/anaconda3/envs/pytorch/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/hwtan/projects/test.py", line 1, in
import sdemodels_op_diy
File "/home/hwtan/projects/sdemodels_op_diy/init.py", line 1, in
from .fused_act import FusedLeakyReLU, fused_leaky_relu
File "/home/hwtan/projects/sdemodels_op_diy/fused_act.py", line 11, in
fused = load(
File "/home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1284, in load
return jit_compile(
File "/home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1509, in jit_compile
write_ninja_file_and_build_library(
File "/home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1624, in write_ninja_file_and_build_library
run_ninja_build(
File "/home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/utils/cpp_extension.py", line 1909, in run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'fused': [1/3] c++ -MMD -MF fused_bias_act.o.d -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/TH -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/THC -isystem /home/hwtan/anaconda3/envs/pytorch/include/python3.9 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -c /home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp -o fused_bias_act.o
In file included from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/c10/core/DeviceType.h:8,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/c10/core/Device.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/core/TensorBody.h:11,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/core/Tensor.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/Tensor.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/function_hook.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/cpp_hook.h:2,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/variable.h:6,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/autograd.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/autograd.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/extension.h:4,
from /home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp:1:
/home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp: In function ‘at::Tensor fused_bias_act(const at::Tensor&, const at::Tensor&, const at::Tensor&, int, int, float, float)’:
/home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp:7:41: 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]
7 | #define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
| ^
/home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp:13:5: note: in expansion of macro ‘CHECK_CUDA’
13 | CHECK_CUDA(input);
| ^~~~~~~~~~
In file included from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/core/Tensor.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/Tensor.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/function_hook.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/cpp_hook.h:2,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/variable.h:6,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/autograd.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/autograd.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/extension.h:4,
from /home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp:1:
/home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/core/TensorBody.h:222:30: note: declared here
222 | DeprecatedTypeProperties & type() const {
| ^~~~
In file included from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/c10/core/DeviceType.h:8,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/c10/core/Device.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/core/TensorBody.h:11,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/core/Tensor.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/Tensor.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/function_hook.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/cpp_hook.h:2,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/variable.h:6,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/autograd.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/autograd.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/extension.h:4,
from /home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp:1:
/home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp:7:41: 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]
7 | #define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
| ^
/home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp:14:5: note: in expansion of macro ‘CHECK_CUDA’
14 | CHECK_CUDA(bias);
| ^~~~~~~~~~
In file included from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/core/Tensor.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/Tensor.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/function_hook.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/cpp_hook.h:2,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/variable.h:6,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/autograd/autograd.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/autograd.h:3,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/all.h:7,
from /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/extension.h:4,
from /home/hwtan/projects/sdemodels_op_diy/fused_bias_act.cpp:1:
/home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/ATen/core/TensorBody.h:222:30: note: declared here
222 | DeprecatedTypeProperties & type() const {
| ^~~~
[2/3] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/TH -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/THC -isystem /home/hwtan/anaconda3/envs/pytorch/include/python3.9 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS -D__CUDA_NO_BFLOAT16_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++17 -c /home/hwtan/projects/sdemodels_op_diy/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
FAILED: fused_bias_act_kernel.cuda.o
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/TH -isystem /home/hwtan/anaconda3/envs/pytorch/lib/python3.9/site-packages/torch/include/THC -isystem /home/hwtan/anaconda3/envs/pytorch/include/python3.9 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS -D__CUDA_NO_BFLOAT16_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS_ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++17 -c /home/hwtan/projects/sdemodels_op_diy/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
435 | function(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:435:145: note: ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
530 | operator=(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:530:146: note: ‘_ArgTypes’
ninja: build stopped: subcommand failed.
Best,
hongwei