amir-saniyan opened a new issue #18869:
URL: https://github.com/apache/incubator-mxnet/issues/18869
## Description
During compilation of MXNet 1.6.0 on Debian 10.5.0 (armhf) to use in
`Raspberry Pi`, compilation failed.
### Error Message
When the build system tries to compile the `np_einsum_op.cc`, the following
error occurred:
```
virtual memory exhausted: Cannot allocate memory
ninja: build stopped: subcommand failed.
```
## To Reproduce
```
$ tar -xvf apache-mxnet-src-1.6.0-incubating.tar.gz
$ cd apache-mxnet-src-1.6.0-incubating
$ mkdir build
$ cd build
$ cmake \
-DSUPPORT_F16C=OFF \
-DUSE_SSE=OFF \
-DUSE_CUDA=OFF \
-DUSE_OPENCV=OFF \
-DUSE_OPENMP=ON \
-DUSE_MKL_IF_AVAILABLE=OFF \
-DUSE_SIGNAL_HANDLER=ON \
-DCMAKE_BUILD_TYPE=Release \
-G Ninja ..
$ ninja
```
## What have you tried to solve it?
I am not running out of memory. The memory is 4 GB and swap is 2 GB.
I am using a 32-bit GCC (Debian, armhf). It only has 3 GiB available for
userspace addresses, and if a single process needs more than that, the error
occurred.
I edited the `build/build.ninja` and changed `-O3` to `-O1` for `FLAGS` of
`np_einsum_op.cc`. After that change, the compilation was success.
Please split large source files (just like `np_einsum_op.cc`) to smaller
source codes to prevent this issue. 32-bit compilers on Linux does not access
more than 3 GB of memory even total memory is too big.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]