I was reading through this article (very good article and excellent blog BTW) to do some measurements in my (very simple) implementation of the Mandelbrot Set.

I'm using a Quadro 2000D card which has a theoretical bandwidth of approximately 20 GB/s ( = 1304 MHz * 128 bit-bus).

Mandelbrot image has 700x700 pixels (uchar = 1 byte per pixel). Launching the kernel with a grid(44,44) and block(16,16) the time elapsed to compute it is 1.00026 ms.

Now if my calculations are good then I have the following


How should I interpret this result? I am only using approx 2.5% of the bandwidth, which is bad but since the algorithm is doing only a write per pixel there's no way to improve this, is there? Is there something I am not taking into account?


I did three types of kernels to see what was going on and reduced the size of the image to 250x250.

First the very naive, 1 thread doing all the work: 125 ms + 3.1% Global efficiency store + 2% occupancy. This is BAD.

Second, one thread per row: 0.20 ms + 97.7% Global store efficiency + 16% occupancy. Much better.

Third, one thread per element: 0.25 ms with 50% Global store efficiency + 55% occupancy. Worst than the previous.

So, from here what can I do to improve? Is there way to do it? The only thing it occurs to me in the third type is to write inside the kernel to shared memory, then synchronize and after that all threads write to global memory so to have coalesced accesses.

  • $\begingroup$ Have you considered how much arithmetic you are doing? Mandelbrot set is embarrassingly parallel (no dependencies between different pixels), so if you are bandwidth limited you are doing it wrong. $\endgroup$ Apr 22 '13 at 19:28
  • $\begingroup$ Yes I know it is embarrassingly parallelizable. I'm sure there are many ways and things to do it very efficient but I'm not an expert, so telling me "You are doing it wrong" doesn't help much. When you say "Bandwidth limited" you mean that the efficient bandwidth used is low? in my case only 2.5%. BTW my calculations are well done? I mean I didn't miss something? $\endgroup$
    – BRabbit27
    Apr 22 '13 at 19:54
  • $\begingroup$ No, bandwidth limited would usually mean you are using a lot of bandwidth. Since you are using a small amount, you are likely not bandwidth limited, which is why I suggested estimating how much arithmetic you are doing. $\endgroup$ Apr 22 '13 at 21:45
  • $\begingroup$ We don't know how many FLOPs your Mandelbrot kernel requires or its arithmetic intensity, so we'd have to guess where on the roofline you are. As @GeoffreyIrving notes, you're working with what is considered a traditionally very arithmetically intense kernel, so it's not surprising that you're not seeing high memory bandwidth (because the code is likely instruction-bound). $\endgroup$ Apr 22 '13 at 21:50
  • $\begingroup$ Thanks for clarifying @GeoffreyIrving. AronAdmadia It is indeed a instruction-bound algorithm, I made an update in my post. $\endgroup$
    – BRabbit27
    Apr 22 '13 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.