/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’: 530 | operator=(_Functor&& __f)

username: Mona_Jalal
cooked: <p>I am trying to setup <code>[pvnet](https://github.com/zju3dv/pvnet)</code> deep learning framework on my desktop. I follow the instructions below and I get this error:</p>
<pre><code class="lang-auto">(pvnet) mona@mona-ThinkStation-P7:~/pvnet/lib/ransac_voting_gpu_layer$ python setup.py clean
running clean
removing 'build/temp.linux-x86_64-cpython-310' (and everything under it)
removing 'build'
(pvnet) mona@mona-ThinkStation-P7:~/pvnet/lib/ransac_voting_gpu_layer$ python setup.py build_ext --inplace
running build_ext
/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/utils/cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/utils/cpp_extension.py:387: UserWarning: The detected CUDA version (11.5) has a minor version mismatch with the version that was used to compile PyTorch (11.7). Most likely this shouldn't be a problem.
  warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
building 'ransac_voting' extension
creating build
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/src
gcc -pthread -B /home/mona/anaconda3/envs/pvnet/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/mona/anaconda3/envs/pvnet/include -fPIC -O2 -isystem /home/mona/anaconda3/envs/pvnet/include -fPIC -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/TH -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/THC -I/home/mona/anaconda3/envs/pvnet/include/python3.10 -c ./src/ransac_voting.cpp -o build/temp.linux-x86_64-cpython-310/./src/ransac_voting.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=ransac_voting -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
/usr/bin/nvcc -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/TH -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/THC -I/home/mona/anaconda3/envs/pvnet/include/python3.10 -c ./src/ransac_voting_kernel.cu -o build/temp.linux-x86_64-cpython-310/./src/ransac_voting_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=ransac_voting -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++14
/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
  435 |         function(_Functor&amp;&amp; __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&amp;&amp; __f)
      |                                                                                                                                                  ^ 
/usr/include/c++/11/bits/std_function.h:530:146: note:         ‘_ArgTypes’
error: command '/usr/bin/nvcc' failed with exit code 1

</code></pre>
<p>Here’s the slightly modified <code>ransac_voting.cpp</code>:</p>
<pre><code class="lang-auto">#include &lt;torch/torch.h&gt;
#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;ATen/cuda/CUDAContext.h&gt;
#include &lt;cuda_runtime.h&gt;


// extern THCState* state;
cudaStream_t stream = at::cuda::getCurrentCUDAStream();

#define CHECK_CUDA(x) AT_ASSERTM(x.options().device().is_cuda(), #x " must be a CUDA tensor")
#define CHECK_CONTIGUOUS(x) AT_ASSERTM(x.is_contiguous(), #x " must be contiguous")
#define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x)

using namespace std;

at::Tensor generate_hypothesis_launcher(
    at::Tensor direct,     // [tn,vn,2]
    at::Tensor coords,     // [tn,2]
    at::Tensor idxs        // [hn,vn,2]
);


at::Tensor generate_hypothesis(
    at::Tensor direct,     // [tn,vn,2]
    at::Tensor coords,     // [tn,2]
    at::Tensor idxs        // [hn,vn,2]
)
{
    CHECK_INPUT(direct);
    CHECK_INPUT(coords);
    CHECK_INPUT(idxs);

    return generate_hypothesis_launcher(direct,coords,idxs);
}

void voting_for_hypothesis_launcher(
    at::Tensor direct,     // [tn,vn,2]
    at::Tensor coords,     // [tn,2]
    at::Tensor hypo_pts,   // [hn,vn,2]
    at::Tensor inliers,    // [hn,vn,tn]
    float inlier_thresh
);

void voting_for_hypothesis(
    at::Tensor direct,     // [tn,vn,2]
    at::Tensor coords,     // [tn,2]
    at::Tensor hypo_pts,   // [hn,vn,2]
    at::Tensor inliers,    // [hn,vn,tn]
    float inlier_thresh
)
{
    CHECK_INPUT(direct);
    CHECK_INPUT(coords);
    CHECK_INPUT(hypo_pts);
    CHECK_INPUT(inliers);

    voting_for_hypothesis_launcher(direct,coords,hypo_pts,inliers,inlier_thresh);
}

at::Tensor generate_hypothesis_vanishing_point_launcher(
    at::Tensor direct,     // [tn,vn,2]
    at::Tensor coords,     // [tn,2]
    at::Tensor idxs        // [hn,vn,2]
);


at::Tensor generate_hypothesis_vanishing_point(
    at::Tensor direct,     // [tn,vn,2]
    at::Tensor coords,     // [tn,2]
    at::Tensor idxs        // [hn,vn,2]
)
{
    CHECK_INPUT(direct);
    CHECK_INPUT(coords);
    CHECK_INPUT(idxs);

    return generate_hypothesis_vanishing_point_launcher(direct,coords,idxs);
}

void voting_for_hypothesis_vanishing_point_launcher(
    at::Tensor direct,     // [tn,vn,2]
    at::Tensor coords,     // [tn,2]
    at::Tensor hypo_pts,   // [hn,vn,3]
    at::Tensor inliers,    // [hn,vn,tn]
    float inlier_thresh
);

void voting_for_hypothesis_vanishing_point(
    at::Tensor direct,     // [tn,vn,2]
    at::Tensor coords,     // [tn,2]
    at::Tensor hypo_pts,   // [hn,vn,2]
    at::Tensor inliers,    // [hn,vn,tn]
    float inlier_thresh
)
{
    CHECK_INPUT(direct);
    CHECK_INPUT(coords);
    CHECK_INPUT(hypo_pts);
    CHECK_INPUT(inliers);

    voting_for_hypothesis_vanishing_point_launcher(direct,coords,hypo_pts,inliers,inlier_thresh);
}


PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
    m.def("generate_hypothesis", &amp;generate_hypothesis, "generate hypothesis");
    m.def("voting_for_hypothesis", &amp;voting_for_hypothesis, "voting for hypothesis");
    m.def("generate_hypothesis_vanishing_point", &amp;generate_hypothesis_vanishing_point, "generate hypothesis vanishing point");
    m.def("voting_for_hypothesis_vanishing_point", &amp;voting_for_hypothesis_vanishing_point, "voting for hypothesis vanishing point");
}

</code></pre>
<p>Here’s the <code>setup.py</code>:</p>
<pre><code class="lang-auto">from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension

setup(
    name='ransac_voting',
    ext_modules=[
        CUDAExtension('ransac_voting', [
            './src/ransac_voting.cpp',
            './src/ransac_voting_kernel.cu'
        ])
    ],
    cmdclass={
        'build_ext': BuildExtension
    }
)
</code></pre>
<p>Here’s some info:</p>
<pre><code class="lang-auto">(pvnet) mona@mona-ThinkStation-P7:~/pvnet/lib/ransac_voting_gpu_layer$ conda list
# packages in environment at /home/mona/anaconda3/envs/pvnet:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             5.1                       1_gnu  
appdirs                   1.4.4                    pypi_0    pypi
astropy                   5.3.4                    pypi_0    pypi
bzip2                     1.0.8                h7b6447c_0  
ca-certificates           2023.08.22           h06a4308_0  
certifi                   2023.7.22                pypi_0    pypi
cffi                      1.16.0                   pypi_0    pypi
charset-normalizer        3.3.0                    pypi_0    pypi
click                     8.1.7                    pypi_0    pypi
cloudpickle               2.2.1                    pypi_0    pypi
contourpy                 1.1.1                    pypi_0    pypi
cycler                    0.12.1                   pypi_0    pypi
cython                    3.0.3                    pypi_0    pypi
dask                      2023.10.0                pypi_0    pypi
easydict                  1.10                     pypi_0    pypi
fonttools                 4.43.1                   pypi_0    pypi
fsspec                    2023.9.2                 pypi_0    pypi
glumpy                    1.2.0                    pypi_0    pypi
idna                      3.4                      pypi_0    pypi
imageio                   2.31.5                   pypi_0    pypi
importlib-metadata        6.8.0                    pypi_0    pypi
joblib                    1.3.2                    pypi_0    pypi
kiwisolver                1.4.5                    pypi_0    pypi
lazy-loader               0.3                      pypi_0    pypi
ld_impl_linux-64          2.38                 h1181459_1  
libffi                    3.4.4                h6a678d5_0  
libgcc-ng                 11.2.0               h1234567_1  
libgomp                   11.2.0               h1234567_1  
libstdcxx-ng              11.2.0               h1234567_1  
libuuid                   1.41.5               h5eee18b_0  
lmdb                      1.4.1                    pypi_0    pypi
locket                    1.0.0                    pypi_0    pypi
mako                      1.2.4                    pypi_0    pypi
markupsafe                2.1.3                    pypi_0    pypi
matplotlib                3.8.0                    pypi_0    pypi
ncurses                   6.4                  h6a678d5_0  
networkx                  3.1                      pypi_0    pypi
numpy                     1.26.1                   pypi_0    pypi
opencv-contrib-python     4.8.1.78                 pypi_0    pypi
openssl                   3.0.11               h7f8727e_2  
packaging                 23.2                     pypi_0    pypi
partd                     1.4.1                    pypi_0    pypi
pillow                    10.1.0                   pypi_0    pypi
pip                       23.2.1          py310h06a4308_0  
platformdirs              3.11.0                   pypi_0    pypi
plyfile                   1.0.1                    pypi_0    pypi
pooch                     1.7.0                    pypi_0    pypi
pyamg                     5.0.1                    pypi_0    pypi
pycparser                 2.21                     pypi_0    pypi
pycuda                    2022.2.2                 pypi_0    pypi
pyerfa                    2.0.1                    pypi_0    pypi
pyparsing                 3.1.1                    pypi_0    pypi
python                    3.10.13              h955ad1f_0  
python-dateutil           2.8.2                    pypi_0    pypi
pytools                   2023.1.1                 pypi_0    pypi
pywavelets                1.4.1                    pypi_0    pypi
pyyaml                    6.0.1                    pypi_0    pypi
readline                  8.2                  h5eee18b_0  
requests                  2.31.0                   pypi_0    pypi
scikit-image              0.22.0                   pypi_0    pypi
scikit-learn              1.3.1                    pypi_0    pypi
scipy                     1.11.3                   pypi_0    pypi
setuptools                68.0.0          py310h06a4308_0  
simpleitk                 2.3.0                    pypi_0    pypi
six                       1.16.0                   pypi_0    pypi
sqlite                    3.41.2               h5eee18b_0  
threadpoolctl             3.2.0                    pypi_0    pypi
tifffile                  2023.9.26                pypi_0    pypi
tk                        8.6.12               h1ccaba5_0  
toolz                     0.12.0                   pypi_0    pypi
torch                     1.13.0+cu117             pypi_0    pypi
torchtext                 0.14.0                   pypi_0    pypi
torchvision               0.14.0+cu117             pypi_0    pypi
tqdm                      4.66.1                   pypi_0    pypi
transforms3d              0.4.1                    pypi_0    pypi
triangle                  20230923                 pypi_0    pypi
typing-extensions         4.8.0                    pypi_0    pypi
tzdata                    2023c                h04d1e81_0  
urllib3                   2.0.6                    pypi_0    pypi
wheel                     0.41.2          py310h06a4308_0  
xz                        5.4.2                h5eee18b_0  
zipp                      3.17.0                   pypi_0    pypi
zlib                      1.2.13               h5eee18b_0  

</code></pre>
<pre><code class="lang-auto">(pvnet) mona@mona-ThinkStation-P7:~/pvnet/lib/ransac_voting_gpu_layer$ python
Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
</code></pre>
<pre><code class="lang-auto">$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0

</code></pre>
<p>and</p>
<pre><code class="lang-auto">$ nvidia-smi
Mon Oct 16 07:50:17 2023       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.125.06   Driver Version: 525.125.06   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA RTX 6000...  Off  | 00000000:52:00.0  On |                  Off |
| 30%   41C    P5    49W / 300W |   1543MiB / 49140MiB |     12%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      2159      G   /usr/lib/xorg/Xorg                524MiB |
|    0   N/A  N/A      2296      G   ...ome-remote-desktop-daemon        6MiB |
|    0   N/A  N/A      2335      G   /usr/bin/gnome-shell              197MiB |
|    0   N/A  N/A      2827      G   ...AAAAAAAAA= --shared-files       72MiB |
|    0   N/A  N/A      3242      G   ...2/usr/lib/firefox/firefox      354MiB |
|    0   N/A  N/A     99342      G   blender                           239MiB |
|    0   N/A  N/A   1402295      G   ...RendererForSitePerProcess       70MiB |
+-----------------------------------------------------------------------------+
</code></pre>
<pre><code class="lang-auto">$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ --version
g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

</code></pre>

username: Mona_Jalal
cooked: <p>This seems to have fixed the problem:</p>
<pre><code class="lang-auto">(pvnet) mona@mona-ThinkStation-P7:~/pvnet/lib/ransac_voting_gpu_layer$ export CMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-10
(pvnet) mona@mona-ThinkStation-P7:~/pvnet/lib/ransac_voting_gpu_layer$ python setup.py clean
running clean
removing 'build/temp.linux-x86_64-cpython-310' (and everything under it)
removing 'build'
(pvnet) mona@mona-ThinkStation-P7:~/pvnet/lib/ransac_voting_gpu_layer$ CC=gcc-10 CXX=g++-10 python setup.py build_ext --inplace
running build_ext
/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/utils/cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/utils/cpp_extension.py:387: UserWarning: The detected CUDA version (11.5) has a minor version mismatch with the version that was used to compile PyTorch (11.7). Most likely this shouldn't be a problem.
  warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
building 'ransac_voting' extension
creating build
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/src
gcc-10 -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/mona/anaconda3/envs/pvnet/include -fPIC -O2 -isystem /home/mona/anaconda3/envs/pvnet/include -fPIC -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/TH -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/THC -I/home/mona/anaconda3/envs/pvnet/include/python3.10 -c ./src/ransac_voting.cpp -o build/temp.linux-x86_64-cpython-310/./src/ransac_voting.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=ransac_voting -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
/usr/bin/nvcc -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/TH -I/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/include/THC -I/home/mona/anaconda3/envs/pvnet/include/python3.10 -c ./src/ransac_voting_kernel.cu -o build/temp.linux-x86_64-cpython-310/./src/ransac_voting_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=ransac_voting -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -ccbin gcc-10 -std=c++14
creating build/lib.linux-x86_64-cpython-310
g++-10 -shared -Wl,-rpath,/home/mona/anaconda3/envs/pvnet/lib -Wl,-rpath-link,/home/mona/anaconda3/envs/pvnet/lib -L/home/mona/anaconda3/envs/pvnet/lib -Wl,-rpath,/home/mona/anaconda3/envs/pvnet/lib -Wl,-rpath-link,/home/mona/anaconda3/envs/pvnet/lib -L/home/mona/anaconda3/envs/pvnet/lib build/temp.linux-x86_64-cpython-310/./src/ransac_voting.o build/temp.linux-x86_64-cpython-310/./src/ransac_voting_kernel.o -L/home/mona/anaconda3/envs/pvnet/lib/python3.10/site-packages/torch/lib -L/usr/lib64 -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda_cu -ltorch_cuda_cpp -o build/lib.linux-x86_64-cpython-310/ransac_voting.cpython-310-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-cpython-310/ransac_voting.cpython-310-x86_64-linux-gnu.so -&gt; 

</code></pre>
<p>I will report if not.</p>