Dawid Bautsch Dev Blog

No category

AMD ROCM: Tensorflow runs native on AMD GPU

dbautsch

Finally it happened! I have been waiting for this since 2016. When I started working in Future Processing in Gliwice with machine learning projects, we used nVidia GeForce 1070 cards and they were strong enough to drive our image recognition algorithms.

Although the cards were fine, I was looking for an alternative solution and I found this: Tensorflow CL (https://github.com/hughperkins/tf-coriander). This is not the perfect solution, it has some drawbacks. There is some performance penalty and someone has to actively keep the code in sync with CUDA version of Tensorflow which is hard. Also the OpenCL port was never hundred percent complete. It was always missing something and it was impossible to use it in the real production environment. The more cheaper approach was to just use nVidia card because of the cost of developer time. That was the reason (I suppose) why this solution has never gained more attention.

Finally we got something worth to use. AMD ROCM. This is an open source solution and can utilize the computing power of even older GPUs like R9 Fury X or RX 480 (see the full list of supported GPUs: https://rocm.github.io/hardware.html).

Let’s see how the guys from AMD describes this technology:
“The ROCm Platform brings a rich foundation to advanced computing by seamlessly integrating the CPU and GPU with the goal of solving real-world problems. This software enables the high-performance operation of AMD GPUs for computationally oriented tasks in the Linux operating system”.


This technology is improving blazingly fast. AMD is doing very good job. The updates are delivered often and there is always something new, something faster and just better delivered through an updates channel (Ubuntu).

When I first meet the port of Tensorflow (which was three months ago) I tried to use some basic samples from tflearn project and some of them didn’t worked properly. But by the next update I’ve seen an improvement and today all from tflearn just works great. The performance is increasing as well. It is a great companion to have AMD Ryzen 7 2700X on board along with Vega 64 GPU.

But how they managed to did the complete port of Tensorflow?
They written AMD HIP which is a tool that allows you to convert (yeah, convert) CUDA code to portable C++. This portable C++ is named AMD HIP C++. HIP can be run on both nVidia CUDA and AMD ROCM platform which is great for increasing the machine learning potential.

There are also ports of PyTorch and MlOpen libraries. Cool!

I’ve done several experiments and I can say that this system is ready to be run on production environment. It can use the full potential of Vega 64 processing power combined with the newest Ryzen processors.

The installation is really easy. If you have Ubuntu then you have nothing to worry. Everything will be done automatically. You just need to have some basic knowledge of Ubuntu package installation process.

Links:
AMD ROCM overview: https://rocm.github.io/index.html
AMD ROCM github: https://github.com/RadeonOpenCompute/ROCm/wiki
AMD HIP: https://github.com/ROCm-Developer-Tools/HIP

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top