Collaboration and Open Source at AMD: LibreOffice

This article is part of an occasional series about what developers can do when they collaborate. AMD is a real believer in open source projects. Our developers actively contribute to and maintain a variety of open source projects, from highly optimized math libraries to… well, let’s talk about LibreOffice.

In case you haven’t heard about LibreOffice, it is an open source project that provides end users with a powerful suite of office productivity software: spreadsheet, word processor, and presentation software. You can learn all about LibreOffice here.

AMD engineers contribute to this project, for good reason. Think about what happens behind a spreadsheet calculation. There can be a huge amount of math. Writing software to take advantage of a Graphics Processing Unit (GPU) for general purpose computing is non-trivial. We know how to do it. AMD engineers wrote OpenCL™ kernels, and contributed them to the open source code base.

The goal was to accelerate the math behind spreadsheets in LibreOffice.

So, how much acceleration did we get? I’m glad you asked.

We took advantage of some nice test spreadsheets to measure performance. These have neat little macros built into them so you can see how long a calculation takes. Just click the button and go, and you see how many milliseconds the calculation takes. Pretty sweet and simple. As you can see in Figure 1, we used the Ground Water Daily test spreadsheet, which is based on a very large real-world data set of ground water levels in the Southeast United States, from the US Geological Service.

LibreOffice Example Sheet
Fig 1: A test run using GPU Compute on the test spreadsheet.

We used LIbreOffice 4.4.4. We ran it under Windows® 8.1, on an AMD A10 7800B APU. The computer had 8 GB of memory. We ran the same spreadsheet calculation with OpenCL on (acceleration via GPU Compute), so that the GPU cores did the heavy lifting. Then we turned OpenCL off, so that the CPU cores had to do all the work.

Here you go.

LibreOffice Results

Well, this is a nice problem to have. I promise you, there is a tiny line next to GPU Compute. Look closely. Turning on the OpenCL option to enable GPU Compute resulted in a 500X+ speedup, about ¼ second vs. 2minutes, 21 seconds.

The time on any run will vary somewhat, based on what else is going on in the machine, so your mileage will vary here. For example, the first run will take longer because the OpenCL kernels must be compiled before execution. But you get the idea: AMD helped enable a huge speed improvement in a free, open source software package.


AMD isn’t entirely altruistic. We win doing this. AMD processors get rated and reviewed based on performance. It is in our self-interest to make things work really, really fast on AMD hardware. However, there are a lot of ways to make that happen. Contributing to any particular open source project is clearly not a necessity.

There really is a belief around here that if we’re going to do something, we should raise the level for everyone. That’s why we commit to open industry standards and open source projects.

Another side of the win is end users, who get speed! The typical end user may have no idea what OpenCL is, or how it works. LibreOffice now defaults to having the OpenCL option on, so users don’t have to do anything for this to work. What they see is that a calculation that took minutes now happens in the literal blink of an eye. At a high level, what this means is that anyone who writes a spreadsheet formula is transparently able to, in effect, create optimized OpenCL kernels. THAT is way cool. There really is a belief around here that if we’re going to do something, we should raise the level for everyone.

The final win is for developers. The community working on LibreOffice got our help. You can read about the effort in a presentation by Michael Meeks at the 2014 IWOCL conference. Collabora also provide support and long term maintenance so that enterprises can confidently deploy an accelerated LibreOffice.

More generally, we build tools for you developers so you can accelerate code by taking advantage of the available GPUs. You can learn about and download the Accelerated Parallel Processing SDK at AMD’s Developer Central website. You can learn a lot at our blog series, OpenCL 2.0 Demystified.  You can download the LibreOffice source code, and see what AMD developers did. That’s the beauty of open source. Our techniques are out there for other developers to see and to learn from.

And that’s a win for all of you. I’d say you can’t lose.


Jim Trudeau is Senior Manager for Developer Outreach at AMD. Links to third party sites and references to third party trademarks, are provided for convenience and illustrative purposes only. Unless explicitly stated, AMD is not responsible for the contents of such links, and no third party endorsement of AMD or any of its products is implied.

Windows is a registered trademarks of Microsoft Corporation. OpenCL is a trademark of Apple Inc. used by permission by Khronos.


29 Responses

  1. Michael Simmons

    The CPU version is probably using 80 bit extended precision for calculations (converting back to double with the result)
    Is the GPU version using single precision or double precision?
    My understanding of the AMD A10 7800B is that the CPU’s are faster than the GPU for double precision.
    So I’m guessing the GPU version is using single precision.
    Maybe this speed up would be 1000x if you used fp16, but it isn’t a very good result if the answers are very inaccurate.
    I’d love to see an workstaion APU with a 1:2 fp64 rate like Hawaii.

    • jtrudeau

      Thanks Michael. I’ll see if I can get an answer from the engineers on the level of precision. Good question. The level of precision can matter, and I assume that’s been considered. However… you remind me of an old joke: Two people driving across the American southwest desert at 100 MPH. The passenger asks… “Do you know where we’re going?” The driver answers “No, but we’re making great time.”

    • jtrudeau

      Michael! Got lucky, got an almost instant answer. Pretty neat answer as well.

      The OpenCL path in LibreOffice Calc uses double precision. The device selection logic excludes all devices that do not support double precision. On the remaining devices, LibreOffice runs a micro-benchmark and determines the fastest device (this device could turn out to be the CPU or the GPU). LibreOffice Calc needs high precision float operations for maximum compatibility with the CPU path.

      In effect, the CPU uses double precision, the GPU calculation must match. If double precision on the GPU is not available or too slow, default back to the CPU.

      • Thijs

        Note that only the x86 FPU supports 80bit. Both SSE (CPU) and GPU-acceleration is calculated in 64-bit (double precision)

    • jtrudeau

      AMD drivers and runtime typically support OpenCL 2.0. I didn’t ask, but I suspect the code that we upstreamed into LibreOffice is compatible with OpenCL 1.2.

    • jtrudeau

      I have confirmed, the code does not require OpenCL 2.0 features, so should work on AMD, NVIDIA, and Intel processors.

  2. Lee

    So what are we actually seeing here? Is this a comparison of native OpenCL code to interpreted older code? The 500x speedup isn’t remotely believable if what you are trying to show is that the GPU is beating the CPU – there is clearly much more to it than that.

    • jtrudeau

      What we’re seeing is the difference between compiled x86 code running on the CPU and compiled OpenCL code running on the GPU. I don’t know whether the OpenCL kernels are precompiled, or generated at runtime.

      Clearly the article does not claim that GPUs are 500x faster than CPUs all the time in all cases. This is about a calculation in a specific spreadsheet. I grabbed that spreadsheet randomly, was genuinely astonished at the performance diff, and made sure I could repeat it and it was real. Other sheets will have different numbers.

    • jtrudeau

      It should, but let me confirm. The A4 graphics cores support OpenCL 1.2. I _THINK_ these changes rely only on OpenCL 1.2 features. I’m checking.

    • jtrudeau

      I have confirmed, the code does not require OpenCL 2.0 features. So you should see improvement on an A4-7300. The GPU cores in that APU are Radeon™ HD 8470D, which support OpenCL 1.2.

  3. Ben Sturmfels

    Are these performance benefits going to be available to people using a fully-free software graphics driver (no binary blobs), or only to those using a proprietary software driver? Advances under a fully-free driver would be a major contribution to the community. Requiring a proprietary driver, on the other hand, might make your words about being a “real believer in open source” seem like empty rhetoric.

    • jtrudeau

      Ben, good point. IMHO this is a place where “your mileage may vary.” Intel, AMD, and NVIDIA all provide drivers. I believe there are open source drivers as well. The article is about software running a step above that, at the application level not the driver level. Changes at the application level should show benefits regardless of the OpenCL runtime/drivers installed on the hardware. But how much benefit could easily vary.

  4. Ben Sturmfels

    Thanks Jim. What AMD graphics device can I buy that supports OpenCL on a free software driver (no binary blobs)? My suspicion is that this hardware optimization is only be available when running your proprietary driver, which would be a real shame for software freedom. I’d be very pleased if you can show otherwise though.

    • jtrudeau

      Hmm, wrote a reply and it has vanished. Probably idiot user error. In any event… You’re right. I was operating on an assumption which appears to be incorrect. I have found some (probably experimental?) open source OpenCL driver projects on Linux, I can’t vouch for completeness or stability. Nor can I discuss our forward looking plans for Linux drivers. But the work behind LibreOffice spreadsheets is not limited to the AMD driver. The results do depend on how each driver is implemented. But in principle you should see improvement on any platform with an OpenCL 1.2 driver.

  5. Diego Capeletti

    All Software should be free, it is a great contribution to the world community bridnarían. Any free software with custodial parties, does not sound good, it is the most fair policy for all its customers and computer users. Anyone can understand the problem of proprietary software, but can recognize the advantages of free software.

    • jtrudeau

      Thanks for the feedback, Diego. While I am a fan of free open source software, If there is real value to someone, it may be worth paying for. There are pros and cons to each.

      • Diego Capeletti

        I understand that the price may be a limitation, but many in the field of free software, we are not concerned about the price to pay, but for our freedom.

      • jjj

        Free software isn’t about price, but about freedom. I have spent more money on free software than on proprietary software.

  6. Reenen

    Is there a list of GFX cards that is supported? Also will other manufacturers than AMD also be supported?

    • jtrudeau

      APUs and GPUs from other manufacturers are supported. What’s required is that the driver and runtime support OpenCL. Intel, NVIDIA, and AMD all do. The degree of support varies, and I can’t speak to whether any particular graphics card does or does not.