[R] bizarre color space conversion problem

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Thu Jul 18 19:59:02 CEST 2019


On Thu, 18 Jul 2019 13:30:09 -0400
Sarah Goslee <sarah.goslee using gmail.com> wrote:

> I'm not even remotely a hardware expert: if the difference is due to
> changes in the instruction set, I assume that has potential
> consequences for other things, and I just happened to spot it in this
> particular case because it's visualization-based? (Yikes.)

Yes, this might be bad. I have heard about OpenBLAS (specifically, the
matrix product routine) misbehaving on certain AVX-512 capable
processors, so much that they had to disable some optimizations in
0.3.6 [*], which you already have installed. Still, would `env
OPENBLAS_CORETYPE=Haswell R --vanilla` give a better result?

> As it says in my first email (but way at the bottom), I'd already
> gotten as far as locating the problem in this line from
> grDevices::convertColor()
> 
>     xyz <- from$toXYZ(color, from.ref.white)

Thanks for confirming this! It felt that I had to make sure, since the
behaviour we observe is so confusing.

> > (red.xyz <- grDevices::colorspaces$sRGB$toXYZ(red.rgb,
> > white.point))[1,]  
> [1] 0.7733981 0.9280769 0.1383974
> > # [1] 0.4168213 0.2149235 0.0195385

One last check: would

red.rgb %*% as.list(environment(grDevices::colorspaces$sRGB$toXYZ))$M

still produce different results on your computers?

> blas.x86_64                                 3.8.0-12.fc30
> openblas.x86_64                             0.3.6-2.fc30

I do not know enough about Fedora's "alternatives" system, but it does
look like R is using OpenBLAS.

> A: working
> Model name:          Intel(R) Xeon(R) CPU E5-1650 v3 @ 3.50GHz

> B: not working
> Model name:          Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz

Again, this points in the direction of OpenBLAS not doing AVX-512 math
properly. Let's hope that OPENBLAS_CORETYPE=Haswell solves it.

-- 
Best regards,
Ivan

[*]
https://github.com/xianyi/OpenBLAS/issues/1955
https://github.com/xianyi/OpenBLAS/issues/2029
https://github.com/xianyi/OpenBLAS/issues/2168
https://github.com/xianyi/OpenBLAS/issues/2182



More information about the R-help mailing list