Repository: pytorch
Issue: build pytorch from source on ubuntu, building error from fbgemm::SparseAdaGradSignature
Labels: module: build,module: collect_env.py,triaged

```
Compiling  functions.cu                        > /data/tseng/toolkit/pytorch/build/nccl/obj/collectives/device/functions.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/queue/rebatching_queue.cc.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/queue/rebatching_queue_ops.cc.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/sgd/adadelta_op.cc.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/sgd/adagrad_fused.cc.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/sgd/adagrad_op.cc.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/sgd/adam_op.cc.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/sgd/clip_tensor_op.cc.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/sgd/ftrl_op.cc.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/sgd/gftrl_op.cc.o
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/sgd/iter_op.cc.o
In file included from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_fused.h:3:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_fused.cc:1:
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h: In member function 'bool caffe2::SparseAdagradOp::DoRunWithType()':
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:253:16: error: no match for call to '(fbgemm::SparseAdaGradSignature<int>::Type {aka std::function<int(int, long unsigned int, float*, const float*, float*, const int*, float, float, float)>}) (long int&, int64_t, float*&, const float*&, float*&, const int32_t*, float&, const float& '
           lr[0]);
                ^
In file included from /data/tseng/toolkit/pytorch/caffe2/core/operator.h:9:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_fused.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_fused.cc:1:
/usr/include/c++/5/functional:2262:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int, long unsigned int, float*, const float*, float*, const int*, float, float, float}]
     function<_Res(_ArgTypes...)>::
     ^
/usr/include/c++/5/functional:2262:5: note:   candidate expects 9 arguments, 8 provided
In file included from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_fused.h:3:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_fused.cc:1:
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:263:16: error: no match for call to '(fbgemm::SparseAdaGradSignature<long int>::Type {aka std::function<int(int, long unsigned int, float*, const float*, float*, const long int*, float, float, float)>}) (long int&, int64_t, float*&, const float*&, float*&, const int64_t*, float&, const float&)'
           lr[0]);
                ^
In file included from /data/tseng/toolkit/pytorch/caffe2/core/operator.h:9:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_fused.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_fused.cc:1:
/usr/include/c++/5/functional:2262:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int, long unsigned int, float*, const float*, float*, const long int*, float, float, float}]
     function<_Res(_ArgTypes...)>::
     ^
/usr/include/c++/5/functional:2262:5: note:   candidate expects 9 arguments, 8 provided
In file included from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:0:
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h: In member function 'bool caffe2::SparseAdagradOp::DoRunWithType()':
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:253:16: error: no match for call to '(fbgemm::SparseAdaGradSignature<int>::Type {aka std::function<int(int, long unsigned int, float*, const float*, float*, const int*, float, float, float)>}) (long int&, int64_t, float*&, const float*&, float*&, const int32_t*, float&, const float& '
           lr[0]);
                ^
In file included from /data/tseng/toolkit/pytorch/caffe2/core/operator.h:9:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:
/usr/include/c++/5/functional:2262:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int, long unsigned int, float*, const float*, float*, const int*, float, float, float}]
     function<_Res(_ArgTypes...)>::
     ^
/usr/include/c++/5/functional:2262:5: note:   candidate expects 9 arguments, 8 provided
In file included from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:0:
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:263:16: error: no match for call to '(fbgemm::SparseAdaGradSignature<long int>::Type {aka std::function<int(int, long unsigned int, float*, const float*, float*, const long int*, float, float, float)>}) (long int&, int64_t, float*&, const float*&, float*&, const int64_t*, float&, const float&)'
           lr[0]);
                ^
In file included from /data/tseng/toolkit/pytorch/caffe2/core/operator.h:9:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:
/usr/include/c++/5/functional:2262:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int, long unsigned int, float*, const float*, float*, const long int*, float, float, float}]
     function<_Res(_ArgTypes...)>::
     ^
/usr/include/c++/5/functional:2262:5: note:   candidate expects 9 arguments, 8 provided
[ 67%] Building CXX object caffe2/CMakeFiles/torch_cpu.dir/sgd/lars_op.cc.o
In file included from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:0:
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h: In instantiation of 'bool caffe2::RowWiseSparseAdagradOp<Context>::DoRunWithType() [with SIndex = int; Context = caffe2::CPUContext]':
/data/tseng/toolkit/pytorch/caffe2/core/operator.h:1302:1:   required from 'static bool caffe2::DispatchHelper<caffe2::TensorTypes<FirstType, Types ...>, ExtraArgs ...>::call(Op*, const caffe2::TypeMeta&) [with Op = caffe2::RowWiseSparseAdagradOp<caffe2::CPUContext>; FirstType = int; Types = {long int}; ExtraArgs = {}]'
/data/tseng/toolkit/pytorch/caffe2/core/operator.h:1302:1:   required from 'static bool caffe2::DispatchHelper<caffe2::TensorTypes<FirstType, Types ...>, ExtraArgs ...>::call(Op*, const caffe2::Tensor&) [with Op = caffe2::RowWiseSparseAdagradOp<caffe2::CPUContext>; FirstType = int; Types = {long int}; ExtraArgs = {}]'
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:376:63:   required from 'bool caffe2::RowWiseSparseAdagradOp<Context>::RunOnDevice() [with Context = caffe2::CPUContext]'
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:215:1:   required from here
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:434:26: error: no match for call to '(fbgemm::SparseAdaGradSignature<int>::Type {aka std::function<int(int, long unsigned int, float*, const float*, float*, const int*, float, float, float)>}) (long int&, int64_t, float*&, const float*&, float*&, const int*, float&, const float&)'
       num_rows_processed = kernel_i32_(
                          ^
In file included from /data/tseng/toolkit/pytorch/caffe2/core/operator.h:9:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:
/usr/include/c++/5/functional:2262:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int, long unsigned int, float*, const float*, float*, const int*, float, float, float}]
     function<_Res(_ArgTypes...)>::
     ^
/usr/include/c++/5/functional:2262:5: note:   candidate expects 9 arguments, 8 provided
In file included from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:0:
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:444:26: error: no match for call to '(fbgemm::SparseAdaGradSignature<long int>::Type {aka std::function<int(int, long unsigned int, float*, const float*, float*, const long int*, float, float, float)>}) (long int&, int64_t, float*&, const float*&, float*&, const int64_t*, float&, const float&)'
       num_rows_processed = kernel_i64_(
                          ^
In file included from /data/tseng/toolkit/pytorch/caffe2/core/operator.h:9:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:
/usr/include/c++/5/functional:2262:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int, long unsigned int, float*, const float*, float*, const long int*, float, float, float}]
     function<_Res(_ArgTypes...)>::
     ^
/usr/include/c++/5/functional:2262:5: note:   candidate expects 9 arguments, 8 provided
In file included from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:0:
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h: In instantiation of 'bool caffe2::RowWiseSparseAdagradOp<Context>::DoRunWithType() [with SIndex = long int; Context = caffe2::CPUContext]':
/data/tseng/toolkit/pytorch/caffe2/core/operator.h:1302:1:   required from 'static bool caffe2::DispatchHelper<caffe2::TensorTypes<FirstType, Types ...>, ExtraArgs ...>::call(Op*, const caffe2::TypeMeta&) [with Op = caffe2::RowWiseSparseAdagradOp<caffe2::CPUContext>; FirstType = long int; Types = {}; ExtraArgs = {}]'
/data/tseng/toolkit/pytorch/caffe2/core/operator.h:1302:1:   required from 'static bool caffe2::DispatchHelper<caffe2::TensorTypes<FirstType, Types ...>, ExtraArgs ...>::call(Op*, const caffe2::TypeMeta&) [with Op = caffe2::RowWiseSparseAdagradOp<caffe2::CPUContext>; FirstType = int; Types = {long int}; ExtraArgs = {}]'
/data/tseng/toolkit/pytorch/caffe2/core/operator.h:1302:1:   required from 'static bool caffe2::DispatchHelper<caffe2::TensorTypes<FirstType, Types ...>, ExtraArgs ...>::call(Op*, const caffe2::Tensor&) [with Op = caffe2::RowWiseSparseAdagradOp<caffe2::CPUContext>; FirstType = int; Types = {long int}; ExtraArgs = {}]'
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:376:63:   required from 'bool caffe2::RowWiseSparseAdagradOp<Context>::RunOnDevice() [with Context = caffe2::CPUContext]'
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:215:1:   required from here
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:434:26: error: no match for call to '(fbgemm::SparseAdaGradSignature<int>::Type {aka std::function<int(int, long unsigned int, float*, const float*, float*, const int*, float, float, float)>}) (long int&, int64_t, float*&, const float*&, float*&, const int32_t*, float&, const float& '
       num_rows_processed = kernel_i32_(
                          ^
In file included from /data/tseng/toolkit/pytorch/caffe2/core/operator.h:9:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:
/usr/include/c++/5/functional:2262:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int, long unsigned int, float*, const float*, float*, const int*, float, float, float}]
     function<_Res(_ArgTypes...)>::
     ^
/usr/include/c++/5/functional:2262:5: note:   candidate expects 9 arguments, 8 provided
In file included from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:0:
/data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:444:26: error: no match for call to '(fbgemm::SparseAdaGradSignature<long int>::Type {aka std::function<int(int, long unsigned int, float*, const float*, float*, const long int*, float, float, float)>}) (long int&, int64_t, float*&, const float*&, float*&, const long int*, float&, const float&)'
       num_rows_processed = kernel_i64_(
                          ^
In file included from /data/tseng/toolkit/pytorch/caffe2/core/operator.h:9:0,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.h:3,
                 from /data/tseng/toolkit/pytorch/caffe2/sgd/adagrad_op.cc:1:
/usr/include/c++/5/functional:2262:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = int; _ArgTypes = {int, long unsigned int, float*, const float*, float*, const long int*, float, float, float}]
     function<_Res(_ArgTypes...)>::
     ^
/usr/include/c++/5/functional:2262:5: note:   candidate expects 9 arguments, 8 provided
caffe2/CMakeFiles/torch_cpu.dir/build.make:10984: recipe for target 'caffe2/CMakeFiles/torch_cpu.dir/sgd/adagrad_fused.cc.o' failed
make[2]: *** [caffe2/CMakeFiles/torch_cpu.dir/sgd/adagrad_fused.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
caffe2/CMakeFiles/torch_cpu.dir/build.make:10997: recipe for target 'caffe2/CMakeFiles/torch_cpu.dir/sgd/adagrad_op.cc.o' failed
make[2]: *** [caffe2/CMakeFiles/torch_cpu.dir/sgd/adagrad_op.cc.o] Error 1
Archiving  objects                             > /data/tseng/toolkit/pytorch/build/nccl/obj/collectives/device/colldevice.a
Linking    libnccl.so.2.7.8                    > /data/tseng/toolkit/pytorch/build/nccl/lib/libnccl.so.2.7.8
Generating nccl.pc.in                          > /data/tseng/toolkit/pytorch/build/nccl/lib/pkgconfig/nccl.pc
Archiving  libnccl_static.a                    > /data/tseng/toolkit/pytorch/build/nccl/lib/libnccl_static.a
/data/tseng/toolkit/pytorch/third_party/nccl/nccl/src
[ 67%] No install step for 'nccl_external'
[ 67%] Completed 'nccl_external'
[ 67%] Built target nccl_external
[ 67%] Building NVCC (Device) object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/gloo_cuda_generated_cuda.cu.o
[ 67%] Building NVCC (Device) object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/nccl/gloo_cuda_generated_nccl.cu.o
[ 67%] Building NVCC (Device) object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/gloo_cuda_generated_cuda_private.cu.o
CMakeFiles/Makefile2:9310: recipe for target 'caffe2/CMakeFiles/torch_cpu.dir/all' failed
make[1]: *** [caffe2/CMakeFiles/torch_cpu.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Scanning dependencies of target gloo_cuda
[ 68%] Building CXX object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/cuda_allreduce_local.cc.o
[ 68%] Building CXX object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/cuda_allreduce_ring.cc.o
[ 68%] Building CXX object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/cuda_allreduce_bcube.cc.o
[ 68%] Building CXX object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/cuda_allreduce_halving_doubling.cc.o
[ 68%] Building CXX object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/cuda_broadcast_one_to_all.cc.o
[ 68%] Building CXX object third_party/gloo/gloo/CMakeFiles/gloo_cuda.dir/cuda_allreduce_ring_chunked.cc.o
[ 68%] Linking CXX static library ../../../lib/libgloo_cuda.a
[ 68%] Built target gloo_cuda
Makefile:159: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
  File "setup.py", line 717, in <module>
    build_deps()
  File "setup.py", line 313, in build_deps
    cmake=cmake)
  File "/data/tseng/toolkit/pytorch/tools/build_pytorch_libs.py", line 62, in build_caffe2
    cmake.build(my_env)
  File "/data/tseng/toolkit/pytorch/tools/setup_helpers/cmake.py", line 345, in build
    self.run(build_args, my_env)
  File "/data/tseng/toolkit/pytorch/tools/setup_helpers/cmake.py", line 141, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/opt/conda/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '16']' returned non-zero exit status 2.
root@eb7398d8aac0:/data/tseng/toolkit/pytorch#
```

cc @malfet @seemethere @walterddr