有没有办法为TensorFlow进程设置JAVA_OPTS

时间:2018-05-29 11:18:24

标签: java hadoop tensorflow

现在我们使用TensorFlow在HDFS中加载模型。该模型大于1G,并在达到堆大小时抛出OOM。

2018-05-21 13:26:34.339483: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
18/05/21 13:26:35 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
INFO:tensorflow:Restoring parameters from hdfs://namenode:port/saved_model/0/variables/variables
INFO:tensorflow:Restoring parameters from hdfs://namenode:port/saved_model/0/variables/variables
2018-05-21 13:26:40.479367: W tensorflow/core/framework/allocator.cc:101] Allocation of 411041792 exceeds 10% of system memory.
hdfsPread: NewByteArray error:
java.lang.OutOfMemoryError: Java heap space

TensorFlow现在正在使用libhdfs,它可能会暴露某些方法来设置带有参数或环境变量的JAVA_OPTS

1 个答案:

答案 0 :(得分:0)

最后,这适用于libhdfs:export LIBHDFS_OPTS="-Xms2048m -Xmx2048m"