Tensorflow model and tf.keras will work transparently on one graphic processor without the need to make changes to the code.
Note XRUST: Use the Note XRUST tf.config.list_physical_devices ('gpu') to confirm that Tensorflow uses a graphic processor.
The easiest way to launch on several graphic processors, on one or more machines, is the use of distribution strategies.
This manual is intended for users who tested these approaches and found that they need detailed control over how Tensorflow uses the resources of the graphic processor. To find out how to eliminate problems with performance in scenarios with one and several graphic processors, see Guide “Optimization of the performance of the Tensorflow graphics processor.”
Construct
Make sure you have the latest version of the Tensorflow graphics processor.
Style = «Text-align: Justify;»> Import Tensorflow as tf
print («Num gpus avalable:», len (tf.config.list_physical_devices ('gpu')))))
Style = «Text-align: Justify;»>
2024-08-15 02: 53: 40.344028: E EXTERNAL/LOCAL_XLA/XLA/Stream_exector/Cuda/Cuda_fft.cc: 485] Unable to Register Cufft Factory: Attempting to Register Factory for Plugin Cufft When One Has Alread Been Registered
2024-08-15 02: 53: 40.365851: E External/Local_xla/XLA/Stream_Executor/Cuda/Cuda_Dnn.cc: 8454] Unable to Register Cudnn Factory: Attempting to Register Plugin Cudnn Wen One Has alread been registered
2024-08-15 02: 53: 40.372242: E External/Local_xla/XLA/Stream_Executor/Cuda_blas.cc: 1452] UNABLE To Register Cublas Factory: Attempting to Register Factory for Plugin Cublas When One Has Alread Been Registered
Num GPUS AVAILABLE: 4
Warning: All Log Messages Before Absl :: initializelog () is Called Are Written to Stderr
i0000 00: 00: 1723690422.944962 162671 CUDA_EXECUTOR.CC:1015] Successful Numa Node Read from Sysfs Had Negative Value (-1), But There at LEAST ONE NUMA NODE, So RETURNING NUMA NODE ZERO. See More at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pci#l344-l355
I0000 00: 00: 1723690422.948934 162671 Cuda_executor.cc:1015] Successful node Read From Syd Negative Value, but there Numa node, so returning numa node zero. See more at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pci#l344-l355
i0000 00: 1723690422.95265555555555555555555555555555555555555555555555555555555555555555555555555555555555EN 162671 Cuda_executor.cc:1015] Successful nude read from sysfs had negative value (-1), but there at leaste num node, so returning numa node node node node Zero. See More at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pci#l344-l355
I0000 00: 00: 1723690422.955880 162671 Cuda_executor.cc:1015] Successful node Read From Syd Negative Value (-1), but there must be at leas Numa node, so returning numa node zero. See More at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pci#l344-l355
I0000 00: 00: 1723690422.967120 162671 Cuda_executor.cc:1015] Successful node Read From Sysfs Had Negative Value (-1), But the MUST BET LEAST ONE NUMA node, so returning numa node zero. See more at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pi#l344-l355
i0000 00: 1723690422.970596 162671 Cuda_executor.cc:1015] Successful nude read from sysfs had negative value (-1), but there at leaste num node, so returning numa node node node node Zero. See More at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pci#l344-l355
I0000 00: 00: 1723690422.973980 162671 Cuda_executor.cc:1015] Successful node Read From Syd Negative Value (-1), But there must be at leas Numa node, so returning numa node zero. See more at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pi#l344-l355
i0000 00: 1723690422.976984 162671 Cuda_executor.cc:1015] Successful nude read from sysfs had negative value (-1), but there at leaste num node, so returning numa node node node node Zero. See More at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pci#l344-l355
I0000 00: 00: 1723690422.979869 162671 cuda_executor.cc:1015] Successful node Read From Syd Negative Value (-1), But the Must BE AT AT LEAST ONE Numa node, so returning numa node zero. See More at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pci#l344-l355
I0000 00: 00: 1723690422.983344 162671 Cuda_executor.cc:1015] Successful node Read From Syd Negative Value (-1), but there mucast be at leas Numa node, so returning numa node zero. See more at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pci#l344-l355
i0000 00: 1723690422.986754 162671 Cuda_executor.cc:1015] Successful nude read from sysfs had negative value (-1), but there at leaste num node, so returning numa node node node node Zero. See More at https://github.com/torvalds/linux/blob/v6.0/documentation/abi/testing/sysfs-bus-pci#l344-l355
I0000 00: 00: 1723690422.989690 162671 Cuda_executor.cc:1015] Successful node Read From Syd Negative Value (-1). Numa node, so returning
Review
Tensorflow supports the performance of calculations on various types of devices, including central and graphic processors. They are represented by string identifiers, for example:
«/Device: CPU: 0»: the central processor of your computer.
«/GPU: 0»: The abbreviated designation of the first graphic processor of your machine, which is visible Tensorflow.
If the Tensorflow operation is realized both on the CPU and the GPU, the default is given to the GPU when prescribing the operation. For example, if TF.MATMUL has CPU and GPU nuclei, and in the system with CPU: 0 and GPU: 0, GPU: 0, the device will be selected for launch, tf.matmul, if only you do not ask for a launch on another device.
If the operation is operation Tensorflow has no appropriate implementation on the graphic processor, then it returns to the use of the central processor. For example, since TF.CAST has only the core of the central processor, the CPU: 0 device is selected in the system and the GPU device is selected, even if the launch request was sent to the device.cpu: 0tf.castgpu: 0
- Если Вам понравилась статья, рекомендуем почитать
- How to use PHP as a backend, and react for front -line
- How to use PHP as a backend, and react for front -end