[Solved] jetson Compile pytorch Error: internal compiler error: Segmentation fault

The following error occurred when compiling pytorch by Jetson:

/usr/include/c++/7/cmath: In static member function ‘static scalar_t at::native::div_floor_kernel_cuda(at::TensorIterator&)::<lambda()>::<lambda()>::<lambda(scalar_t, scalar_t)>::_FUN(scalar_t, scalar_t)’:
/usr/include/c++/7/cmath:1302:38: internal compiler error: Segmentation fault
   { return __builtin_copysignf(__x, __y); }

This is because compiling STD::copysign() is too expensive for the Jetson platform.

There are two solutions:
1. upgrade pytorch to version 1.9. Pytorch 1.9 uses the C10::CUDA::compat::copysign()function instead of the STD::copysign()function.
2. Submit and modify the code according to this:
Workaround arm64 gcc error in std::copysign on Jetson platforms

Read More: