### (Solved) OpenCL double precision in release 2.2.13

• 11 Replies
• 691 Views

0 Members and 1 Guest are viewing this topic.

#### piotrv

• Fractal Friend
• Posts: 12

#### OpenCL double precision in release 2.2.13

« on: March 31, 2018, 11:09:47 PM »
Rendering in OpenCL modi limited | full returns an error:
Code: [Select]
Error: Error during compilation of OpenCL programOpenCL Build log:<kernel>:80:9: error: use of type 'double' requires cl_khr_fp64 extension to be enabled                        for (double r = 1.0; r < quality; r += rRandom)
This issue is with OpenCL 1.1 which needs to have cl_khr_fp64 enabled to support double

Code: [Select]
qmake --versionQMake version 3.1Using Qt version 5.9.4 in /opt/qt59/libclinfo | grep   " OpenCL"  Platform Version                                OpenCL 1.2 CUDA 9.0.368  Device Version                                  OpenCL 1.1 CUDA  Device OpenCL C Version                         OpenCL C 1.1     Run OpenCL kernels                            Yes  ICD loader Name                                 OpenCL ICD Loader  ICD loader Profile                              OpenCL 1.2 NOTE: your OpenCL library declares to support OpenCL 1.2, but it seems to support up to OpenCL 2.1 too.
In Program Preferences | OpenCL Precision: single

So why this error still ?

I also tried to run with precision overridden, i.e.

Code: [Select]
mandelbulber2 --override opencl_precision=singlebut it doesn't make any difference.

It's an older Dell i7 laptop and obviously I didn't had this issue with release <= 2.2.12.1

« Last Edit: April 03, 2018, 10:56:15 AM by piotrv »

#### buddhi

• Fractal Friar
• Posts: 129

#### Re: OpenCL double precision in release 2.2.13

« Reply #1 on: April 01, 2018, 07:23:21 AM »
Thanks for reporting this problem.
It's a small mistake is the code
Should be
for (double r = 1.0f; ......

1.0 is declared as a double precision. This fails with old gfx drivers.

I will release corrected package in next few days.

#### buddhi

• Fractal Friar
• Posts: 129

#### Re: OpenCL double precision in release 2.2.13

« Reply #2 on: April 02, 2018, 10:34:19 AM »
I have prepared package with patch for testing:

#### piotrv

• Fractal Friend
• Posts: 12

#### Re: OpenCL double precision in release 2.2.13

« Reply #3 on: April 02, 2018, 07:49:26 PM »
I have prepared package with patch for testing:
Can you test on your system?

Unfortunately 1.0f seems to make no difference :

Code: [Select]
Error: Error during compilation of OpenCL programOpenCL Build log:<kernel>:80:9: error: use of type 'double' requires cl_khr_fp64 extension to be enabled                        for (double r = 1.0f; r < quality; r += rRandom)

#### buddhi

• Fractal Friar
• Posts: 129

#### Re: OpenCL double precision in release 2.2.13

« Reply #4 on: April 02, 2018, 08:26:45 PM »
I was probably blind when I checked the code

It was obvious that
for (double r = 1.0f; r < quality; r += rRandom)
cannot work

I was focused only on double precision constants.

Here is new package for testing:

#### piotrv

• Fractal Friend
• Posts: 12

#### Re: OpenCL double precision in release 2.2.13

« Reply #5 on: April 03, 2018, 10:59:57 AM »
I was probably blind when I checked the code
I didn't have the guts to tell you

Problem solved. Super !

#### Micha1982

• Fractal Phenom
• Posts: 48

#### Re: OpenCL double precision in release 2.2.13

« Reply #6 on: April 10, 2018, 02:40:20 PM »
Regarding double precision in general, wouldn´t it be possible to activate that cl_khr_fp64-extension and use double-precision for OpenCL at all in Mandelbulber (having my pixels in mind for example or whatever else it is being used for)? For sure it may not so fast as single-precision, but maybe still faster than a cpu...or is that no possible?

#### hobold

• Fractal Feline
• Posts: 195

#### Re: OpenCL double precision in release 2.2.13

« Reply #7 on: April 10, 2018, 04:52:56 PM »
Regarding double precision in general, wouldn´t it be possible to activate that cl_khr_fp64-extension and use double-precision for OpenCL at all in Mandelbulber (having my pixels in mind for example or whatever else it is being used for)? For sure it may not so fast as single-precision, but maybe still faster than a cpu...or is that no possible?
Not all GPUs support double precision; some simply do not have the capability. And those GPUs which are capable of double precision are either not very good at it (at say, 1/32 the performance of single precision) or extremely expensive models tailored to compute tasks.

There are a few exceptions. For example, the good old Radeon HD 5870 performs double precision computations at 1/4 the performance of its single precision capability. In contrast, the much newer Radeon Vega 56 only offers 1/16 throughput for double precision, so the old HD 5870 can, in principle, keep up.

Nvidia differentiates their product lines even more strongly; their consumer GPUs generally offer double precision at 1/32 throughput, if at all.

To put this into perspective, let's compare CPUs and GPUs with respect to their double precision throughput. For example, AMD's new entry level processor "Ryzen 3 2200G" combines four Ryzen cores with eight Radeon Vega compute units. The integrated GPU has roughly the same double precision throughput as the four processor cores together. If you compare to an eight core "Ryzen 7" model without GPU, you end up with roughly the same double precision throughput using roughly the same amount of silicon.

A Radeon Vega 64 GPU is eight times more capable than the integrated GPU on the little processor. So it roughly delivers the double precision throughput of 8*4 = 32 Ryzen cores (that would be a high end EPYC processor for servers).

Long story short: if you do have a nice GPU, it is definitely worth using for double precision computations. But it will "only" be maybe two to three times faster than your CPU, not 10s or 100s of times as you might have hoped for.

#### Micha1982

• Fractal Phenom
• Posts: 48

#### Re: OpenCL double precision in release 2.2.13

« Reply #8 on: April 10, 2018, 06:02:55 PM »
But it will "only" be maybe two to three times faster than your CPU, not 10s or 100s of times as you might have hoped for.
1-2 days rendering or only a half day makes a big difference...

Not all GPUs support double precision; some simply do not have the capability.
I dont know which one exactly does not support it, i suspect older ones or Amd maybe...on the quick I found just things like "Every GPU with SM 1.3 (Tesla/GTX2xx) or better has hardware double-precision support.", "NVIDIA processors in particular have had double-precision support for years"...dont know how hard it would be to integrate but could single/doubleprecision not being made switchable as an options?

Anyway, it would be great if the missing things would be ported to OpenCL first at all...singleprecision-OpenCL is still much better in my opinion than render on a/my cpus

#### buddhi

• Fractal Friar
• Posts: 129

#### Re: OpenCL double precision in release 2.2.13

« Reply #9 on: April 13, 2018, 08:58:35 PM »
Micha1982, you are right that most of modern GFX cards support double precision but even GTX 1080 is 32 times slower for double precision than for single.
This very expensive GFX card is only two times faster for double precision than i7 (in theory) and two times more expensive.
But I'm not sure if this number of GFLOPS is achievable for such a big rendering kernels like are used in Mandelbulber.
Reference information: https://en.wikipedia.org/wiki/GeForce_10_series

#### Micha1982

• Fractal Phenom
• Posts: 48

#### Re: OpenCL double precision in release 2.2.13

« Reply #10 on: April 16, 2018, 10:23:20 AM »
That may be correct...but faster is faster, not matter how much. As said, 1 day or half a day 'sometimes' make a big difference. For sure it is not as fast as as SP...but nevertheless faster in most cases than on most cpus. And if not, for the other cases where its still possible to switch to cpu. And if not, I dont know if or how it could be made be possible, but maybe a switch in the option could be made for the cases where Doubleprecision really makes no sense/to use only Singleprecision on GPU...just an idea...

#### mclarekin

• Fractal Freak
• Posts: 660

#### Re: OpenCL double precision in release 2.2.13

« Reply #11 on: April 16, 2018, 02:58:42 PM »
Double precision is likely to be implemented in the future. We have quite a few months of necessary work ahead of us and our programming time is limited, (also in my case, the programming time and ability is limited).

### Similar Topics

###### "Time Span"

Started by cricke49 on Fractal Image Gallery

0 Replies
449 Views
August 02, 2018, 07:05:21 AM
by cricke49
###### [Solved] Color interpolation

Started by galac on Programming

5 Replies
375 Views
March 02, 2019, 09:03:11 AM
by mclarekin
###### OpenCL issues since release 2.17

Started by piotrv on Mandelbulber

11 Replies
597 Views
April 25, 2019, 05:09:55 PM
by piotrv
###### precision loss when passing a Double from script to uniforms

Started by claude on Fragmentarium

11 Replies
391 Views
January 18, 2019, 02:23:06 AM
by claude
###### Birdie Style

Started by gannjondal on Fractal Image Gallery

1 Replies
495 Views
May 08, 2018, 02:39:37 PM
by who8mypnuts