syurkevi · GitHub

@GuillaumeSchmid @umar456

The arguments provided to OpenCL uses the C++ standard library
function std::to_string(). This function uses the locale to render
it's argument to a string.
It is a problem when arrayfire is used in a
software initialised with non "C" locale.
For instance, on a French computer, to_string(1.0) will output the
string "1,0000000".
This string is provided to OpenCL kernels, generating a syntax error.
The most portable way to fix this problem is to use a local ostringstream
imbued withe "C" locale.
An Other way would be to use C++17 to_chars function, as it only renders it
argument with "C" locale, without impact from the application or
system locale.
The patch is pretty simple, it changes the toString() function to use
the stringstream in src/backend/common/TemplateArg.cpp and changed the
to_string calls to this toString function in types.cpp.

Read the original on github.com ↗