Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Tensorflow support Cuda streams?

Tags:

tensorflow

Does Tensorflow utilize Cuda streams automatically for concurrent execution of the computation graph on a single GPU or should streams be assigned manually to ops/tensors ?

like image 672
Henry Chinner Avatar asked Mar 19 '16 07:03

Henry Chinner


People also ask

How do CUDA streams work?

A stream in CUDA is a sequence of operations that execute on the device in the order in which they are issued by the host code. While operations within a stream are guaranteed to execute in the prescribed order, operations in different streams can be interleaved and, when possible, they can even run concurrently.

Is CUDA necessary for TensorFlow?

The GPU-enabled version of TensorFlow has the following requirements: 64-bit Linux. Python 2.7. CUDA 7.5 (CUDA 8.0 required for Pascal GPUs)

What is CUDA in TensorFlow?

What is CUDA? It provides everything you need to develop GPU-accelerated applications. A parallel computing platform and application programming interface model,it enables developers to speed up compute-intensive applications by harnessing the power of GPUs for the parallelizable part of the computation.

How does TensorFlow use GPU?

By default, TensorFlow maps nearly all of the GPU memory of all GPUs (subject to CUDA_VISIBLE_DEVICES ) visible to the process. This is done to more efficiently use the relatively precious GPU memory resources on the devices by reducing memory fragmentation. To limit TensorFlow to a specific set of GPUs, use the tf.


1 Answers

For now, TensorFlow only uses one compute stream, and multiple copy streams. Some kernels may choose to use multiple streams for computation, while maintaining a single-stream semantics.

Our experiment showed that enabling multi-stream automatically does not bring much performance gains, since most of our kernels are large enough to utilize all processors in GPU. But enabling multi-stream would disable our current design to recycle GPU memory aggressively.

This is a decision we might revisit in the future. If that happens, it is likely for TensorFlow to automatically assign ops/kernels to different Cuda streams, without exposing them to users.

like image 76
zhengxq Avatar answered Oct 13 '22 09:10

zhengxq