tensorflow-gpu

Tensorflow Java Multi-GPU inference

半腔热情 提交于 2019-12-04 19:05:22
问题 I have a server with multiple GPUs and want to make full use of them during model inference inside a java app. By default tensorflow seizes all available GPUs, but uses only the first one. I can think of three options to overcome this issue: Restrict device visibility on process level, namely using CUDA_VISIBLE_DEVICES environment variable. That would require me to run several instances of the java app and distribute traffic among them. Not that tempting idea. Launch several sessions inside a

Very low GPU usage during training in Tensorflow

六眼飞鱼酱① 提交于 2019-12-03 12:56:44
I am trying to train a simple multi-layer perceptron for a 10-class image classification task, which is a part of the assignment for the Udacity Deep-Learning course. To be more precise, the task is to classify letters rendered from various fonts (the dataset is called notMNIST). The code I ended up with looks fairly simple, but no matter what I always get very low GPU usage during training. I measure load with GPU-Z and it shows just 25-30%. Here is my current code: graph = tf.Graph() with graph.as_default(): tf.set_random_seed(52) # dataset definition dataset = Dataset.from_tensor_slices({'x

ImportError: No module named 'nets'

房东的猫 提交于 2019-12-03 12:48:16
I am trying to convert trained_checkpoint to final frozen model from the export_inference_graph.py script provided in tensorflow/models,but the following error results. And yes,I have already setup $PYTHONPATH to "models/slim" but still I get this error,can someone help me out? $ echo $PYTHONPATH :/home/ishara/tensorflow_models/models:/home/ishara/tensorflow_models/models/slim *****************************problem**************************************************************************** $sudo python3 object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path =

Tensorflow Java Multi-GPU inference

↘锁芯ラ 提交于 2019-12-03 11:49:54
I have a server with multiple GPUs and want to make full use of them during model inference inside a java app. By default tensorflow seizes all available GPUs, but uses only the first one. I can think of three options to overcome this issue: Restrict device visibility on process level, namely using CUDA_VISIBLE_DEVICES environment variable. That would require me to run several instances of the java app and distribute traffic among them. Not that tempting idea. Launch several sessions inside a single application and try to assign one device to each of them via ConfigProto : public class

First tf.session.run() performs dramatically different from later runs. Why?

北战南征 提交于 2019-12-03 07:44:15
Here's an example to clarify what I mean: First session.run(): First run of a TensorFlow session Later session.run(): Later runs of a TensorFlow session I understand TensorFlow is doing some initialization here, but I'd like to know where in the source this manifests. This occurs on CPU as well as GPU, but the effect is more prominent on GPU. For example, in the case of a explicit Conv2D operation, the first run has a much larger quantity of Conv2D operations in the GPU stream. In fact, if I change the input size of the Conv2D, it can go from tens to hundreds of stream Conv2D operations. In

Understanding the ResourceExhaustedError: OOM when allocating tensor with shape

孤者浪人 提交于 2019-12-03 04:43:53
问题 I'm trying to implement a skip thought model using tensorflow and a current version is placed here. Currently I using one GPU of my machine (total 2 GPUs) and the GPU info is 2017-09-06 11:29:32.657299: I tensorflow/core/common_runtime/gpu/gpu_device.cc:940] Found device 0 with properties: name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate (GHz) 1.683 pciBusID 0000:02:00.0 Total memory: 10.91GiB Free memory: 10.75GiB However, I got OOM when I'm trying to feed data to the model. I try

How to optimize for inference a simple, saved TensorFlow 1.0.1 graph?

安稳与你 提交于 2019-12-03 02:04:34
问题 I cannot successfully run the optimize_for_inference module on a simple, saved TensorFlow graph (Python 2.7; package installed by pip install tensorflow-gpu==1.0.1 ). Background Saving TensorFlow Graph Here's my Python script to generate and save a simple graph to add 5 to my input x placeholder operation. import tensorflow as tf # make and save a simple graph G = tf.Graph() with G.as_default(): x = tf.placeholder(dtype=tf.float32, shape=(), name="x") a = tf.Variable(5.0, name="a") y = tf.add

Understanding the ResourceExhaustedError: OOM when allocating tensor with shape

陌路散爱 提交于 2019-12-02 18:45:27
I'm trying to implement a skip thought model using tensorflow and a current version is placed here . Currently I using one GPU of my machine (total 2 GPUs) and the GPU info is 2017-09-06 11:29:32.657299: I tensorflow/core/common_runtime/gpu/gpu_device.cc:940] Found device 0 with properties: name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate (GHz) 1.683 pciBusID 0000:02:00.0 Total memory: 10.91GiB Free memory: 10.75GiB However, I got OOM when I'm trying to feed data to the model. I try to debug as follow: I use the following snippet right after I run sess.run(tf.global_variables

How to run Tensorflow Estimator on multiple GPUs with data parallelism

天涯浪子 提交于 2019-12-02 16:52:18
I have a standard tensorflow Estimator with some model and want to run it on multiple GPUs instead of just one. How can this be done using data parallelism? I searched the Tensorflow Docs but did not find an example; only sentences saying that it would be easy with Estimator. Does anybody have a good example using the tf.learn.Estimator? Or a link to a tutorial or so? I think tf.contrib.estimator.replicate_model_fn is a cleaner solution. The following is from tf.contrib.estimator.replicate_model_fn documentation, ... def model_fn(...): # See `model_fn` in `Estimator`. loss = ... optimizer = tf

How to optimize for inference a simple, saved TensorFlow 1.0.1 graph?

假装没事ソ 提交于 2019-12-02 15:38:55
I cannot successfully run the optimize_for_inference module on a simple, saved TensorFlow graph (Python 2.7; package installed by pip install tensorflow-gpu==1.0.1 ). Background Saving TensorFlow Graph Here's my Python script to generate and save a simple graph to add 5 to my input x placeholder operation. import tensorflow as tf # make and save a simple graph G = tf.Graph() with G.as_default(): x = tf.placeholder(dtype=tf.float32, shape=(), name="x") a = tf.Variable(5.0, name="a") y = tf.add(a, x, name="y") saver = tf.train.Saver() with tf.Session(graph=G) as sess: sess.run(tf.global