In tensorflow
1.x,有一个选项,例如use_unified_memory
and per_process_gpu_memory_fraction
这有可能触发 CUDA UVM 的使用。但这怎么能在tensorflow
2.0?
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/protobuf/config.proto https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/protobuf/config.proto
// If true, uses CUDA unified memory for memory allocations. If
// per_process_gpu_memory_fraction option is greater than 1.0, then unified
// memory is used regardless of the value for this field. See comments for
// per_process_gpu_memory_fraction field for more details and requirements
// of the unified memory. This option is useful to oversubscribe memory if
// multiple processes are sharing a single GPU while individually using less
// than 1.0 per process memory fraction.
bool use_unified_memory = 2;
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 2
config.gpu_options.allow_growth = True
session = InteractiveSession(config=config)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)