Build Error Raspberry Pi - aten_dispatch.cpp Cannot allocate memory


(Antonin Raffin) #1

Hello,
I’m trying to compile the master branch (pytorch >= 0.4, commit 4251e38) on a raspberry pi 3.
In the past, it worked (v0.4a after the pull request #4473) but now i have got a memory issue when it compiles aten_dispatch.cpp : virtual memory exhausted: Cannot allocate memory

I tried augmenting the swap space (up to 3 Go) but it still fails…
Do you have any suggestion to make it compile ?

Full error:

building 'torch._C' extension
[1/1] arm-linux-gnueabihf-gcc -pthread -DNDEBUG -...mv7l-2.7/torch/csrc/jit/generated/aten_dispatch.d
FAILED: build/temp.linux-armv7l-2.7/torch/csrc/jit/generated/aten_dispatch.o 
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/home/enstar/pytorch -I/home/enstar/pytorch/torch/csrc -I/home/enstar/pytorch/third_party/pybind11/include -I/home/enstar/pytorch/torch/lib/tmp_install/include -I/home/enstar/pytorch/torch/lib/tmp_install/include/TH -I/home/enstar/pytorch/torch/lib/tmp_install/include/THNN -I/home/enstar/pytorch/torch/lib/tmp_install/include/ATen -I/home/enstar/.local/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c torch/csrc/jit/generated/aten_dispatch.cpp -o build/temp.linux-armv7l-2.7/torch/csrc/jit/generated/aten_dispatch.o -D_THP_CORE -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-write-strings -Wno-zero-length-array -Wno-unknown-pragmas -Wno-deprecated-declarations -fno-strict-aliasing -Wno-missing-braces -DWITH_NUMPY -MMD -MF build/temp.linux-armv7l-2.7/torch/csrc/jit/generated/aten_dispatch.d
virtual memory exhausted: Cannot allocate memory
ninja: build stopped: subcommand failed.
Command '['/home/enstar/.local/lib/python2.7/site-packages/ninja/data/bin/ninja', '-f', 'build/build.torch._C.ninja']' returned non-zero exit status 1

(Antonin Raffin) #2

It finally compiled after PR #7562: https://github.com/pytorch/pytorch/pull/7562