Linux – Floating-point errors in OpenCL via ssh

Floating-point errors in OpenCL via ssh… here is a solution to the problem.

Floating-point errors in OpenCL via ssh

I found problems with floating-point arithmetic in OpenCL. Here is my kernel :

__kernel void MyKernel(__global const float4* _pInput, __global float4* _pOutput)
{
    int IndexOfRow      = get_global_id(0);
    int NumberOfRows    = get_global_size(0);
    int IndexOfColumn   = get_global_id(1);
    int NumberOfColumns = get_global_size(1);

...

_pOutput[0] = 1.9f * 100.0f;  constant float return value
}

After the kernel executes and downloads the output buffer, the result on different clients connected using SSH is always 100. If I execute the program locally, the result is 190. It seems that the number after the decimal point is truncated.

The operating system is Open Suse Linux with AMD OpenCL 1.2.

What’s the problem?

Solution

I just found a solution. This depends on the ENV setting of the LANG. It must be en_US. UTF-8。 You can check it using env|grep LANG.

This may be a JIT compiler error. In Germany, float is used, “, not “.” Writing.

Related Problems and Solutions