PyTorch / Caffe2 can not be installed on latest JetPack release

Using a brand new JetPack 3.2 installation I get the following error when trying to install Caffe2:

[url]https://github.com/pytorch/pytorch/issues/6846[/url]

Steps:

git clone --recursive GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration
cd pytorch
git submodule update --init
cd scripts
./build_tegra_x1.sh

Error message:

[ 79%] Linking CXX executable …/bin/operator_fallback_gpu_test
…/lib/libcaffe2_gpu.so: undefined reference to void caffe2::math::BiasCHW<float, caffe2::CUDAContext>(float const*, int, int, float*, caffe2::CUDAContext*)' collect2: error: ld returned 1 exit status caffe2/CMakeFiles/elementwise_op_gpu_test.dir/build.make:115: recipe for target 'bin/elementwise_op_gpu_test' failed make[2]: *** [bin/elementwise_op_gpu_test] Error 1 CMakeFiles/Makefile2:1614: recipe for target 'caffe2/CMakeFiles/elementwise_op_gpu_test.dir/all' failed make[1]: *** [caffe2/CMakeFiles/elementwise_op_gpu_test.dir/all] Error 2 [ 79%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state_mkl.cc.o ../lib/libcaffe2_gpu.so: undefined reference to void caffe2::math::BiasCHW<float, caffe2::CUDAContext>(float const*, int, int, float*, caffe2::CUDAContext*)’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/operator_fallback_gpu_test.dir/build.make:115: recipe for target ‘bin/operator_fallback_gpu_test’ failed
make[2]: *** [bin/operator_fallback_gpu_test] Error 1
CMakeFiles/Makefile2:1570: recipe for target ‘caffe2/CMakeFiles/operator_fallback_gpu_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/operator_fallback_gpu_test.dir/all] Error 2
[ 80%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state_gpu.cc.o
[ 80%] Linking CXX shared module python/caffe2_pybind11_state_gpu.so
[ 80%] Built target caffe2_pybind11_state_gpu
Makefile:138: recipe for target ‘all’ failed
make: *** [all] Error 2

Can somebody help me on how to fix the installation?

Browsing the code for the definition and implementation of the BiasCHW() template function you are getting the undefined reference for, I’m not exactly sure why it is missing from your build. Do you have a BLAS backend like openblas or Atlas installed?

Does it work if you try PyTorch version 0.3.0 (git checkout v0.3.0)? That’s the version I currently use, as master typically has breaking changes with the examples and such. You can hop onto their Slack channel to find out more if you haven’t already.

Hi. Thank you for the quick reply:

openblas or Atlas: I did not install anything by my own. I used a completely fresh Jetpack 3.2 install.
Typing in >>> np.config.show():

np.config.show()
lapack_info:
NOT AVAILABLE
lapack_opt_info:
NOT AVAILABLE
openblas_lapack_info:
NOT AVAILABLE
blas_info:
NOT AVAILABLE
atlas_3_10_blas_threads_info:
NOT AVAILABLE
atlas_threads_info:
NOT AVAILABLE
blas_src_info:
NOT AVAILABLE
openblas_clapack_info:
NOT AVAILABLE
atlas_3_10_threads_info:
NOT AVAILABLE
atlas_blas_info:
NOT AVAILABLE
atlas_3_10_blas_info:
NOT AVAILABLE
lapack_src_info:
NOT AVAILABLE
atlas_blas_threads_info:
NOT AVAILABLE
openblas_info:
NOT AVAILABLE
blas_mkl_info:
NOT AVAILABLE
blas_opt_info:
NOT AVAILABLE
blis_info:
NOT AVAILABLE
atlas_info:
NOT AVAILABLE
atlas_3_10_info:
NOT AVAILABLE
lapack_mkl_info:
NOT AVAILABLE

I will now try to install pytorch 0.3.0. But this does not help with Caffe2 - as it does not ship with it. Have you tested Caffe2 successfully yet?

It seems that it has been tested successfully before with the Eigen package upgraded, see this post:
https://devtalk.nvidia.com/default/topic/1030538/jetson-tx2/caffe2-on-jetson-tx2-gpu-support-/post/5242870/#5242870

Hi there.

Ok: Downgraded to JetPack 3.1. Upgraded to latest Eigen 3.3. Now I get this error:

Linking CXX executable …/bin/reshape_op_gpu_test
…/lib/libcaffe2_gpu.so: undefined reference to void caffe2::math::BiasCHW<float, caffe2::CUDAContext>(float const*, int, int, float*, caffe2::CUDAContext*)' collect2: error: ld returned 1 exit status caffe2/CMakeFiles/reshape_op_gpu_test.dir/build.make:115: recipe for target 'bin/reshape_op_gpu_test' failed make[2]: *** [bin/reshape_op_gpu_test] Error 1 CMakeFiles/Makefile2:1570: recipe for target 'caffe2/CMakeFiles/reshape_op_gpu_test.dir/all' failed make[1]: *** [caffe2/CMakeFiles/reshape_op_gpu_test.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 79%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state_dlpack.cc.o [ 79%] Linking CXX executable ../bin/operator_fallback_gpu_test [ 79%] Linking CXX executable ../bin/elementwise_op_gpu_test ../lib/libcaffe2_gpu.so: undefined reference to void caffe2::math::BiasCHW<float, caffe2::CUDAContext>(float const*, int, int, float*, caffe2::CUDAContext*)’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/operator_fallback_gpu_test.dir/build.make:115: recipe for target ‘bin/operator_fallback_gpu_test’ failed
make[2]: *** [bin/operator_fallback_gpu_test] Error 1
CMakeFiles/Makefile2:1658: recipe for target ‘caffe2/CMakeFiles/operator_fallback_gpu_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/operator_fallback_gpu_test.dir/all] Error 2
[ 79%] Building CXX object caffe2/CMakeFiles/caffe2_pybind11_state_gpu.dir/python/pybind_state_gpu.cc.o
…/lib/libcaffe2_gpu.so: undefined reference to `void caffe2::math::BiasCHW<float, caffe2::CUDAContext>(float const*, int, int, float*, caffe2::CUDAContext*)’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/elementwise_op_gpu_test.dir/build.make:115: recipe for target ‘bin/elementwise_op_gpu_test’ failed
make[2]: *** [bin/elementwise_op_gpu_test] Error 1
CMakeFiles/Makefile2:1614: recipe for target ‘caffe2/CMakeFiles/elementwise_op_gpu_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/elementwise_op_gpu_test.dir/all] Error 2
[ 80%] Linking CXX shared module python/caffe2_pybind11_state_gpu.so
[ 80%] Built target caffe2_pybind11_state_gpu
Makefile:138: recipe for target ‘all’ failed
make: *** [all] Error 2

Very frustrating…

Are you trying PyTorch master with JetPack 3.1? Because that thread was posted probably before Caffe2/PyTorch merge occurred.
I would downgrade Caffe2 version until the upstream framework maintainers identify their fix.