linux - 通过环境变量限制 TensorFlow GPU 内存使用
问题描述
我正在使用内部使用 Tensorflow 的 C++ 库,因此我无权访问会话参数。
创建 Tensorflow 会话时,可以通过设置per_process_gpu_memory_fraction
值和allow growth
标志来限制 GPU 内存使用(Python 中的示例):
memory_config = tf.ConfigProto(gpu_options=tf.GPUOptions(per_process_gpu_memory_fraction=0.3))
memory_config.gpu_options.allow_growth=True
如果未在: in linux shell 中指定此选项,也可以设置allow growth
使用环境变量的全局值。tf.ConfigProto
export TF_FORCE_GPU_ALLOW_GROWTH=true
per_process_gpu_memory_fraction
我想知道是否有用于全局设置的环境变量?
解决方案
推荐阅读
- mongodb - 如何根据日期、星期和月份范围限制管道的结果?
- spring-boot - Spring data JPA填充2个一对多关系的数据
- javascript - 向地图功能添加密钥不起作用
- d3.js - 如何调整 d3.js 地球的大小?
- php - PHP - 在 Wordpress / Woocommerce 中为 JSON 包添加多个数组
- java - 如何更正此代码以使其通用?
- java - 错误:尝试运行 jar 文件时无法找到或加载主类
- neo4j - Neo4j:使用 distance() 函数确定房屋之间的距离
- android - 将power bi报表与手机APP集成
- terraform - RDS:如何使用 terraform 脚本将副本 (MariaDB) 提升为独立数据库实例?