pytorch / pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration
https://pytorch.org
Other
83.11k stars 22.41k forks source link

Compiling PyTorch from Source on Xavier #94801

Open ohyunju opened 1 year ago

ohyunju commented 1 year ago

🐛 Describe the bug

My device: Xavier (JetPack 4.6.2)

I want pytorch 1.10.0 with python 3.7 upper version.

I try on python 3.8. But build compile end with error. ninja: build stopped: subcommand failed.

I think main issue is,

immintrin.h: No such file or directory
unrecognized command line option ‘-mavx’ ‘-mavx2’ ‘-mfma’ ‘-mavx512f’ ‘-mavx512dq’ ‘-mavx512vl’ ‘-mavx512bw’ ‘-mvsx’
arch:AVX AVX2 AVX512: No such file or directory

c++: error: unrecognized command line option '-Wshorten-64-to-32'
c++: error: unrecognized command line option '-wd654'
c++: error: unrecognized command line option '-Wthread-safety'; did you mean '-fthread-jumps'?

src.c:6:9: error: impossible constraint in ‘asm’
CheckSymbolExists.c:8:19: error: ‘strtod_l’ undeclared

cc1plus: error: -Werror=cast-function-type: no option -Wcast-function-type

Details,
CMakeError.log how i can fix it?

I refer to https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048.

Error logs

Building wheel torch-1.10.0a0+git36449ea -- Building version 1.10.0a0+git36449ea cmake --build . --target install --config Release -- -j 8 [14/383] Building NVCC (Device) object...orch_cuda_generated_SegmentReduce.cu.o /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu: In lambda function: /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:54:51: 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_DISPATCH_INDEX_TYPES( ^ /home/ai/Desktop/yjoh/git/pytorch/build/aten/src/ATen/core/TensorBody.h:194:1: note: declared here DeprecatedTypeProperties & type() const { ^ ~~ /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:54:112: warning: ‘c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)’ is deprecated: passing at::DeprecatedTypeProperties to an AT_DISPATCH macro is deprecated, pass an at::ScalarType instead [-Wdeprecated-declarations] AT_DISPATCH_INDEX_TYPES( ^ /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/Dispatch.h:176:1: note: declared here inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties& t) { ^~~ /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu: In lambda function: /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:231:58: 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_DISPATCH_INDEX_TYPES( ^ /home/ai/Desktop/yjoh/git/pytorch/build/aten/src/ATen/core/TensorBody.h:194:1: note: declared here DeprecatedTypeProperties & type() const { ^ ~~ /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:231:119: warning: ‘c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)’ is deprecated: passing at::DeprecatedTypeProperties to an AT_DISPATCH macro is deprecated, pass an at::ScalarType instead [-Wdeprecated-declarations] AT_DISPATCH_INDEX_TYPES( ^ /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/Dispatch.h:176:1: note: declared here inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties& t) { ^~~ /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu: In lambda function: /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:291:51: 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_DISPATCH_INDEX_TYPES( ^ /home/ai/Desktop/yjoh/git/pytorch/build/aten/src/ATen/core/TensorBody.h:194:1: note: declared here DeprecatedTypeProperties & type() const { ^ ~~ /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/cuda/SegmentReduce.cu:291:112: warning: ‘c10::ScalarType detail::scalar_type(const at::DeprecatedTypeProperties&)’ is deprecated: passing at::DeprecatedTypeProperties to an AT_DISPATCH macro is deprecated, pass an at::ScalarType instead [-Wdeprecated-declarations] AT_DISPATCH_INDEX_TYPES( ^ /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/Dispatch.h:176:1: note: declared here inline at::ScalarType scalar_type(const at::DeprecatedTypeProperties& t) { ^~~ [51/383] Building NVCC (Device) object...cuda/torch_cuda_generated_SoftMax.cu.o /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/sparse/cuda/SoftMax.cu: In function ‘at::Tensor at::native::_GLOBALN42_tmpxft_000014a5_00000000_6_SoftMax_cpp1_ii_75209b9c::get_offsets(const at::Tensor&, const IntArrayRef&, int64_t)’: /home/ai/Desktop/yjoh/git/pytorch/aten/src/ATen/native/sparse/cuda/SoftMax.cu:240:69: warning: ‘at::GenericPackedTensorAccessor<T, N, PtrTraits, index_t> at::Tensor::packed_accessor() const & [with T = long int; long unsigned int N = 2; PtrTraits = at::DefaultPtrTraits; index_t = long int]’ is deprecated: packed_accessor is deprecated, use packed_accessor32 or packed_accessor64 instead [-Wdeprecated-declarations] auto indices_accessor = indices.packed_accessor<int64_t, 2>(); ^ /home/ai/Desktop/yjoh/git/pytorch/build/aten/src/ATen/core/TensorBody.h:228:1: note: declared here GenericPackedTensorAccessor<T,N,PtrTraits,index_t> packed_accessor() const & { ^ ~~~~~

.....

../torch/csrc/jit/python/init.cpp: In lambda function: ../torch/csrc/jit/python/init.cpp:492:30: error: cannot bind non-const lvalue reference of type ‘pybind11::detail::accessor&’ to an rvalue of type ‘pybind11::detail::generic_iterator::reference {aka pybind11::detail::accessor}’ for (auto& obj : inputs) { ^~ ninja: build stopped: subcommand failed.

Minified repro

No response

Versions

git clone --recursive --branch v1.10.0 http://github.com/pytorch/pytorch python3 setup.py bdist_wheel

cc @malfet @seemethere @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh

albanD commented 1 year ago

cc @malfet is this related to non AVX machines support we discussed?

ptrblck commented 1 year ago

@ohyunju to build PyTorch from source for Jetson devices you could check these instructions or use any of the pre-built binaries from here.

ohyunju commented 1 year ago

@ptrblck yes, I followed these instructions , and here also. "here" section is pytorch 1.12.0 version upper. And my above errors out while follwing "these instructions" section.