1

Executing Tensorflow test suite using command:

bazel test //tensorflow/...

throws Out of memory issue:

INFO: Found 1886 targets and 1155 test targets...
INFO: Elapsed time: 291.775s, Critical Path: 0.91s
java.lang.OutOfMemoryError: Java heap space
        at com.google.devtools.build.skyframe.SkyKey.create(SkyKey.java:57)
        at com.google.devtools.build.lib.skyframe.ArtifactSkyKey.key(ArtifactSkyKey.java:43)
        at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.toKeys(ActionExecutionFunction.java:576)
        at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:158)
        at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:370)
        at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:501)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Java heap space

bazel ran out of memory and crashed.

I have tried below options still issue persists.

export _JAVA_OPTIONS="-Xms1024m -Xmx1024m"

export JVM_ARGS="-Xmx1024m -XX:MaxPermSize=256m"

export JVM_ARGS="-XX:PermSize=64M -XX:MaxPermSize=256m"

Also, changed the file from bazel code: scripts/bootstrap/compile.sh

" run "${JAVAC}" -J-Xms1g -J-Xmx1g -classpath "${classpath}" -sourcepath "${sourcepath}""

Machine configurations: Ubuntu distribution, openjdk8, RAM 16G

Nayana
  • 127
  • 1
  • 9

1 Answers1

1

Try to set JAVA_OPTIONS with the correct name and without quotes characters :

JAVA_OPTIONS= -Xms512m -Xmx1024m

If it doesn't work, maybe the JAVA_OPTIONS env variable is not used.
You could try to specify directly the arguments in the execution command. According to the official documentation, you could do :

bazel test --host_jvm_args=-Xms512m --host_jvm_args=-Xmx1024m //tensorflow/...
davidxxx
  • 115,998
  • 20
  • 192
  • 199
  • Thanks! Below command worked for me: `bazel --host_jvm_args="-Xms512m" --host_jvm_args="-Xmx1024m" test //tensorflow/...` – Nayana Mar 22 '17 at 13:10