简体   繁体   中英

How to run tensorflow using GPU?

Tensorflow version - 1.0.1 GPU version - 1.0.1 python - 3.6 Graphics(Ubuntu 18.04) - Intel® Sandybridge Desktop We are trying to run a python code using Tensorflow. But it was very slow. So, we would like to run the code on GPU. Can anyone suggest how to use GPU for running python code?

您可以卸载张量流并安装 GPU 兼容版本

pip install tensorflow-gpu
config = tf.compat.v1.ConfigProto(gpu_options = tf.compat.v1.GPUOptions(per_process_gpu_memory_fraction=0.8))
config.gpu_options.allow_growth = True
session = tf.compat.v1.Session(config=config)
tf.compat.v1.keras.backend.set_session(session)

Place this code before your python code and also make sure you have all the cuDNN dlls installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM