1
$\begingroup$

For scientific reasons, we have to use doubles in our shaders. We don't need to talk about trying to store data in floating point numbers and so on. I know there is special GPU hardware for double precision to work faster than on regular GPUs.

We are writing some GPU based software that should work for standard GPUs (2015 - now). Do OpenGL, Vulkan, CUDA and OpenCL support double precision? In the case of using a GPU that is not designed to use doubles, do the APIs emulate them? So would such software work on these hardware systems?

$\endgroup$
6
  • $\begingroup$ GLSL supports doubles in the language to check hardware support in OpenGL look up the "GL_ARB_gpu_shader_fp64" extension. To check hardware support in Vulkan check the physical device limits VkPhysicalDeviceProperties deviceProperties.limits.shaderDoublePrecision Support is generally binary. If you do run into a driver that is somehow emulating doubles the performance will be blatantly clear. $\endgroup$
    – pmw1234
    Apr 28, 2023 at 12:56
  • $\begingroup$ Why would OpenGL or Vulkan benefit from double precision ? When it comes to display, 4 digits accuracy can be overkill. $\endgroup$
    – user1703
    Apr 28, 2023 at 14:14
  • 1
    $\begingroup$ @YvesDaoust the doubles are used for physical accuracy... Not for displaying. $\endgroup$
    – Thomas
    Apr 28, 2023 at 19:39
  • 2
    $\begingroup$ Why even debate the efficacy of existing functionality? The question is about if it is supported, which it is. $\endgroup$
    – pmw1234
    Apr 28, 2023 at 21:35
  • 1
    $\begingroup$ GPU's are used for more then just generating pixel colors. Scientific applications can/should take advantage of all that floating point power and they often require high precision to get reasonable results. Take a look at the "Frontier" super computer, at ~1.7 exaflops it uses GPU's to generate all that floating point power. $\endgroup$
    – pmw1234
    Apr 29, 2023 at 10:21

1 Answer 1

2
$\begingroup$

Double-precision operations have been a requirement of desktop OpenGL and GLSL since 4.0. GPUs don't "emulate" double precision, but that doesn't mean they operate at full-speed either. As with most things, Vulkan is a bit more fine-grained, as SPIR-V requires you to use the Float64 if you want to use them, and the implementation must support the shaderFloat64 feature.

$\endgroup$
1
  • $\begingroup$ So the program would run on any machine which supports opengl 4.0 $\endgroup$
    – Thomas
    Apr 29, 2023 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.