Use single job for building TFLite when RAM isn't enough
During native ARM build of TFLite, some devices will get frozen by OOM during the building. This patch prevents it. This patch fixes GitHub issue #36336. PiperOrigin-RevId: 294363969 Change-Id: I0cef7df39d8084544a21a6fa012f04968f492939
This commit is contained in:
parent
69dc52a704
commit
901e6af539
@ -20,5 +20,13 @@ set -e
|
|||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
TENSORFLOW_DIR="${SCRIPT_DIR}/../../../.."
|
TENSORFLOW_DIR="${SCRIPT_DIR}/../../../.."
|
||||||
|
|
||||||
make -j 4 TARGET=aarch64 -C "${TENSORFLOW_DIR}" -f tensorflow/lite/tools/make/Makefile
|
FREE_MEM="$(free -m | awk '/^Mem/ {print $2}')"
|
||||||
|
# Use "-j 4" only memory is larger than 2GB
|
||||||
|
if [[ "FREE_MEM" -gt "2000" ]]; then
|
||||||
|
NO_JOB=4
|
||||||
|
else
|
||||||
|
NO_JOB=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
make -j ${NO_JOB} TARGET=aarch64 -C "${TENSORFLOW_DIR}" -f tensorflow/lite/tools/make/Makefile
|
||||||
|
|
||||||
|
@ -20,5 +20,13 @@ set -e
|
|||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
TENSORFLOW_DIR="${SCRIPT_DIR}/../../../.."
|
TENSORFLOW_DIR="${SCRIPT_DIR}/../../../.."
|
||||||
|
|
||||||
make -j 4 TARGET=rpi -C "${TENSORFLOW_DIR}" -f tensorflow/lite/tools/make/Makefile
|
FREE_MEM="$(free -m | awk '/^Mem/ {print $2}')"
|
||||||
|
# Use "-j 4" only memory is larger than 2GB
|
||||||
|
if [[ "FREE_MEM" -gt "2000" ]]; then
|
||||||
|
NO_JOB=4
|
||||||
|
else
|
||||||
|
NO_JOB=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
make -j ${NO_JOB} TARGET=rpi -C "${TENSORFLOW_DIR}" -f tensorflow/lite/tools/make/Makefile
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user