简体   繁体   中英

clang: error: unsupported option '-fopenmp' (SparseConvNe build error)

Thank you first for your help and time. I am trying to run and build SparseConvNet ( https://github.com/facebookresearch/SparseConvNet )on my Mac, however, I get the following error after running bash develop.sh on my terminal:

running develop
running egg_info
creating sparseconvnet.egg-info
writing sparseconvnet.egg-info/PKG-INFO
writing dependency_links to sparseconvnet.egg-info/dependency_links.txt
writing top-level names to sparseconvnet.egg-info/top_level.txt
writing manifest file 'sparseconvnet.egg-info/SOURCES.txt'
package init file 'sparseconvnet/SCN/__init__.py' not found (or not a regular file)
reading manifest file 'sparseconvnet.egg-info/SOURCES.txt'
writing manifest file 'sparseconvnet.egg-info/SOURCES.txt'
running build_ext
building 'sparseconvnet.SCN' extension
creating build
creating build/temp.macosx-10.6-x86_64-3.5
creating build/temp.macosx-10.6-x86_64-3.5/sparseconvnet
creating build/temp.macosx-10.6-x86_64-3.5/sparseconvnet/SCN
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/sahar/opt/anaconda3/envs/mypython3/include -arch x86_64 -I/Users/sahar/opt/anaconda3/envs/mypython3/include -arch x86_64 -I/Users/sahar/Documents/test_sparse/SparseConvNet/sparseconvnet/SCN/ -I/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include -I/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include -I/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/TH -I/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/THC -I/Users/sahar/opt/anaconda3/envs/mypython3/include/python3.5m -c sparseconvnet/SCN/pybind.cpp -o build/temp.macosx-10.6-x86_64-3.5/sparseconvnet/SCN/pybind.o -std=c++14 -fopenmp /usr/local/bin/g++-11 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=SCN -D_GLIBCXX_USE_CXX11_ABI=0
clang: warning: /usr/local/bin/g++-11: 'linker' input unused [-Wunused-command-line-argument]
clang: error: unsupported option '-fopenmp'
error: command '/usr/bin/clang' failed with exit status 1 

after some search I figured out that the problem may be with the clang so I installed gcc as follow:

brew install gcc and I added the path in my bash_profile as follow:

export CC=/usr/local/bin/gcc-11 export CXX=/usr/local/bin/g++-11

I also modified the following line in setub.py

from extra = {'cxx': ['-std=c++14', '-fopenmp','-O3'], 'nvcc': ['-std=c++14', '-Xcompiler', '-fopenmp', '-O3']}

to extra = {'cxx': ['-std=c++14', '-fopenmp', "/usr/local/bin/g++-11"], 'nvcc': ['-std=c++14', '-Xcompiler', '-fopenmp', '-O3']}

After doing the aforementioned steps I get the following error

/usr/local/bin/gcc-11 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/sahar/opt/anaconda3/envs/mypython3/include -arch x86_64 -I/Users/sahar/opt/anaconda3/envs/mypython3/include -arch x86_64 -I/Users/sahar/Documents/test_sparse/SparseConvNet/sparseconvnet/SCN/ -I/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include -I/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include -I/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/TH -I/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/THC -I/Users/sahar/opt/anaconda3/envs/mypython3/include/python3.5m -c sparseconvnet/SCN/sparseconvnet_cpu.cpp -o build/temp.macosx-10.6-x86_64-3.5/sparseconvnet/SCN/sparseconvnet_cpu.o -std=c++14 -fopenmp /usr/local/bin/g++-11 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=SCN -D_GLIBCXX_USE_CXX11_ABI=0
cc1plus: warning: command-line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
In file included from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/core/Device.h:5,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/core/Allocator.h:6,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/ATen.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/extension.h:4,
                 from sparseconvnet/SCN/sparseconvnet_cpu.cpp:12:
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/jit/attributes.h: In function 'const char* torch::jit::toString(torch::jit::AttributeKind)':
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/jit/attributes.h:21:42: warning: expression does not compute the number of elements in this array; element type is 'const char*', not 'torch::jit::AttributeKind' -Wsizeof-array-div]
   21 |   AT_ASSERT(size_t(kind) < sizeof(names) / sizeof(AttributeKind));
      |                            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/util/Exception.h:148:39: note: in definition of macro 'C10_EXPAND_MSVC_WORKAROUND'
  148 | #define C10_EXPAND_MSVC_WORKAROUND(x) x
      |                                       ^
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/util/Exception.h:167:34: note: in expansion of macro 'C10_UNLIKELY'
  167 | #define C10_UNLIKELY_OR_CONST(e) C10_UNLIKELY(e)
      |                                  ^~~~~~~~~~~~
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/util/Exception.h:204:7: note: in expansion of macro 'C10_UNLIKELY_OR_CONST'
  204 |   if (C10_UNLIKELY_OR_CONST(!(cond))) {       \
      |       ^~~~~~~~~~~~~~~~~~~~~
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/util/Exception.h:360:32: note: in expansion of macro 'TORCH_INTERNAL_ASSERT'
  360 |     C10_EXPAND_MSVC_WORKAROUND(TORCH_INTERNAL_ASSERT(__VA_ARGS__)); \
      |                                ^~~~~~~~~~~~~~~~~~~~~
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/jit/attributes.h:21:3: note: in expansion of macro 'AT_ASSERT'
   21 |   AT_ASSERT(size_t(kind) < sizeof(names) / sizeof(AttributeKind));
      |   ^~~~~~~~~
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/jit/attributes.h:21:44: note: add parentheses around 'sizeof (torch::jit::AttributeKind)' to silence this warning
   21 |   AT_ASSERT(size_t(kind) < sizeof(names) / sizeof(AttributeKind));
      |                                            ^~~~~~~~~~~~~~~~~~~~~
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/util/Exception.h:148:39: note: in definition of macro 'C10_EXPAND_MSVC_WORKAROUND'
  148 | #define C10_EXPAND_MSVC_WORKAROUND(x) x
      |                                       ^
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/util/Exception.h:167:34: note: in expansion of macro 'C10_UNLIKELY'
  167 | #define C10_UNLIKELY_OR_CONST(e) C10_UNLIKELY(e)
      |                                  ^~~~~~~~~~~~
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/util/Exception.h:204:7: note: in expansion of macro 'C10_UNLIKELY_OR_CONST'
  204 |   if (C10_UNLIKELY_OR_CONST(!(cond))) {       \
      |       ^~~~~~~~~~~~~~~~~~~~~
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/c10/util/Exception.h:360:32: note: in expansion of macro 'TORCH_INTERNAL_ASSERT'
  360 |     C10_EXPAND_MSVC_WORKAROUND(TORCH_INTERNAL_ASSERT(__VA_ARGS__)); \
      |                                ^~~~~~~~~~~~~~~~~~~~~
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/jit/attributes.h:21:3: note: in expansion of macro 'AT_ASSERT'
   21 |   AT_ASSERT(size_t(kind) < sizeof(names) / sizeof(AttributeKind));
      |   ^~~~~~~~~
In file included from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/jit/ir.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/autograd/generated/variable_factories.h:12,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/types.h:7,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/extension.h:4,
                 from sparseconvnet/SCN/sparseconvnet_cpu.cpp:12:
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/jit/attributes.h:19:22: note: array 'names' declared here
   19 |   static const char* names[] = {
      |                      ^~~~~
In file included from sparseconvnet/SCN/sparseconvnet_cpu.cpp:33:
sparseconvnet/SCN/CPU/SparseToDense.cpp: In instantiation of 'void cpu_SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with T = float; int Dimension = 1]':
sparseconvnet/SCN/sparseconvnet_cpu.cpp:387:51:   required from 'void SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with int Dimension = 1]'
sparseconvnet/SCN/sparseconvnet_cpu.cpp:566:1:   required from here
sparseconvnet/SCN/CPU/SparseToDense.cpp:48:29: error: cannot convert 'std::array<long int, 3>' to 'c10::IntArrayRef' {aka 'c10::ArrayRef<long long int>'}
   48 |     output_features.resize_(sz);
      |                             ^~
      |                             |
      |                             std::array<long int, 3>
In file included from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Tensor.h:12,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Context.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/ATen.h:5,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/extension.h:4,
                 from sparseconvnet/SCN/sparseconvnet_cpu.cpp:12:
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/core/TensorMethods.h:961:45: note:   initializing argument 1 of 'at::Tensor& at::Tensor::resize_(c10::IntArrayRef) const'
  961 | inline Tensor & Tensor::resize_(IntArrayRef size) const {
      |                                 ~~~~~~~~~~~~^~~~
In file included from sparseconvnet/SCN/sparseconvnet_cpu.cpp:33:
sparseconvnet/SCN/CPU/SparseToDense.cpp: In instantiation of 'void cpu_SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with T = float; int Dimension = 2]':
sparseconvnet/SCN/sparseconvnet_cpu.cpp:387:51:   required from 'void SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with int Dimension = 2]'
sparseconvnet/SCN/sparseconvnet_cpu.cpp:569:1:   required from here
sparseconvnet/SCN/CPU/SparseToDense.cpp:48:29: error: cannot convert 'std::array<long int, 4>' to 'c10::IntArrayRef' {aka 'c10::ArrayRef<long long int>'}
   48 |     output_features.resize_(sz);
      |                             ^~
      |                             |
      |                             std::array<long int, 4>
In file included from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Tensor.h:12,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Context.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/ATen.h:5,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/extension.h:4,
                 from sparseconvnet/SCN/sparseconvnet_cpu.cpp:12:
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/core/TensorMethods.h:961:45: note:   initializing argument 1 of 'at::Tensor& at::Tensor::resize_(c10::IntArrayRef) const'
  961 | inline Tensor & Tensor::resize_(IntArrayRef size) const {
      |                                 ~~~~~~~~~~~~^~~~
In file included from sparseconvnet/SCN/sparseconvnet_cpu.cpp:33:
sparseconvnet/SCN/CPU/SparseToDense.cpp: In instantiation of 'void cpu_SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with T = float; int Dimension = 3]':
sparseconvnet/SCN/sparseconvnet_cpu.cpp:387:51:   required from 'void SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with int Dimension = 3]'
sparseconvnet/SCN/sparseconvnet_cpu.cpp:572:1:   required from here
sparseconvnet/SCN/CPU/SparseToDense.cpp:48:29: error: cannot convert 'std::array<long int, 5>' to 'c10::IntArrayRef' {aka 'c10::ArrayRef<long long int>'}
   48 |     output_features.resize_(sz);
      |                             ^~
      |                             |
      |                             std::array<long int, 5>
In file included from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Tensor.h:12,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Context.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/ATen.h:5,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/extension.h:4,
                 from sparseconvnet/SCN/sparseconvnet_cpu.cpp:12:
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/core/TensorMethods.h:961:45: note:   initializing argument 1 of 'at::Tensor& at::Tensor::resize_(c10::IntArrayRef) const'
  961 | inline Tensor & Tensor::resize_(IntArrayRef size) const {
      |                                 ~~~~~~~~~~~~^~~~
In file included from sparseconvnet/SCN/sparseconvnet_cpu.cpp:33:
sparseconvnet/SCN/CPU/SparseToDense.cpp: In instantiation of 'void cpu_SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with T = float; int Dimension = 4]':
sparseconvnet/SCN/sparseconvnet_cpu.cpp:387:51:   required from 'void SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with int Dimension = 4]'
sparseconvnet/SCN/sparseconvnet_cpu.cpp:575:1:   required from here
sparseconvnet/SCN/CPU/SparseToDense.cpp:48:29: error: cannot convert 'std::array<long int, 6>' to 'c10::IntArrayRef' {aka 'c10::ArrayRef<long long int>'}
   48 |     output_features.resize_(sz);
      |                             ^~
      |                             |
      |                             std::array<long int, 6>
In file included from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Tensor.h:12,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Context.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/ATen.h:5,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/extension.h:4,
                 from sparseconvnet/SCN/sparseconvnet_cpu.cpp:12:
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/core/TensorMethods.h:961:45: note:   initializing argument 1 of 'at::Tensor& at::Tensor::resize_(c10::IntArrayRef) const'
  961 | inline Tensor & Tensor::resize_(IntArrayRef size) const {
      |                                 ~~~~~~~~~~~~^~~~
In file included from sparseconvnet/SCN/sparseconvnet_cpu.cpp:33:
sparseconvnet/SCN/CPU/SparseToDense.cpp: In instantiation of 'void cpu_SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with T = float; int Dimension = 5]':
sparseconvnet/SCN/sparseconvnet_cpu.cpp:387:51:   required from 'void SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with int Dimension = 5]'
sparseconvnet/SCN/sparseconvnet_cpu.cpp:578:1:   required from here
sparseconvnet/SCN/CPU/SparseToDense.cpp:48:29: error: cannot convert 'std::array<long int, 7>' to 'c10::IntArrayRef' {aka 'c10::ArrayRef<long long int>'}
   48 |     output_features.resize_(sz);
      |                             ^~
      |                             |
      |                             std::array<long int, 7>
In file included from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Tensor.h:12,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Context.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/ATen.h:5,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/extension.h:4,
                 from sparseconvnet/SCN/sparseconvnet_cpu.cpp:12:
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/core/TensorMethods.h:961:45: note:   initializing argument 1 of 'at::Tensor& at::Tensor::resize_(c10::IntArrayRef) const'
  961 | inline Tensor & Tensor::resize_(IntArrayRef size) const {
      |                                 ~~~~~~~~~~~~^~~~
In file included from sparseconvnet/SCN/sparseconvnet_cpu.cpp:33:
sparseconvnet/SCN/CPU/SparseToDense.cpp: In instantiation of 'void cpu_SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with T = float; int Dimension = 6]':
sparseconvnet/SCN/sparseconvnet_cpu.cpp:387:51:   required from 'void SparseToDense_updateOutput(at::Tensor&, Metadata<Dimension>&, at::Tensor&, at::Tensor&, long int) [with int Dimension = 6]'
sparseconvnet/SCN/sparseconvnet_cpu.cpp:581:1:   required from here
sparseconvnet/SCN/CPU/SparseToDense.cpp:48:29: error: cannot convert 'std::array<long int, 8>' to 'c10::IntArrayRef' {aka 'c10::ArrayRef<long long int>'}
   48 |     output_features.resize_(sz);
      |                             ^~
      |                             |
      |                             std::array<long int, 8>
In file included from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Tensor.h:12,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/Context.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/ATen.h:5,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/csrc/api/include/torch/all.h:4,
                 from /Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/torch/extension.h:4,
                 from sparseconvnet/SCN/sparseconvnet_cpu.cpp:12:
/Users/sahar/opt/anaconda3/envs/mypython3/lib/python3.5/site-packages/torch/include/ATen/core/TensorMethods.h:961:45: note:   initializing argument 1 of 'at::Tensor& at::Tensor::resize_(c10::IntArrayRef) const'
  961 | inline Tensor & Tensor::resize_(IntArrayRef size) const {
      |                                 ~~~~~~~~~~~~^~~~
error: command '/usr/local/bin/gcc-11' failed with exit status 1 

I tested my code both by poetry and anaconda and in both, I get the same error.

I'm unsure about the error you received after adjusting the setub.py file (may be due to changing the compiler version being called), but your original error seems to relate to the MacOS version of clang not natively supporting fopenmp. A solution for this was posted here:

Enable OpenMP support in clang in Mac OS X (sierra & Mojave)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM