Closed stla closed 2 years ago
Could you provide a minimal reproducible example?
Hi, I'm preparing a figure, to see if at least the Mac results make sense. I'll post the results of my investigations here.
That makes sense, the triangulation is correct. The first figure is the one obtained with Windows and Unix, the second one is the one obtained with Mac. The red edges are the fixed edges.
Concyclic points are known not to have a unique Delaunay triangulation. And different order of vertex insertion can produce slightly different results.
But when called with exactly the same inputs/parameters it should provide the same result regardless the OS.
Yes, strange. I have been told that Mac has no longer support for long doubles. Could it be the cause?
It could be. I observed different triangulations with doubles vs floats converted from doubles. It is a guessing game without a concrete example.
Im almost sure, different results are caused by different random.h implementations on win and linux.
@msokalski
std::mt19937
PRNG with a fixed seed is used and nothing else. This should be portable to my knowledge.
I also run the tests on Windows/macOS/Ubuntu and did not find any platform specific results.
@stla
Could you please provide the exact input example?
Sure, i'll do tonight. I'm not sure which part of RNG tricked me in similar way (mersenne tweester or actual distribiution generator) but I've experienced differences between linux and windows in my random input to DCT test generator.
@msokalski If I remember right distributions are not portable, but plane generator should be fine.
Ahh, probably you're right. So the other thing that came to my mind is different FAST_FMA define on Mac. If @stla used buggy predicates it could make a difference. Anyway I'm going to check the RNG thing.
Nope, RNG results are same on Win10+VC and Ubuntu 20.04+gcc/clang. I was wrong, sorry.
I get the same results with Windows and Linux. Different results are on Mac. I'll give the point coordinates later.
Here is the input.
Angles: 2*pi/12, 4*pi/12, 6*pi/12, ..., 22*pi/12, 24*pi/12
Points: (cos(angle), sin(angle))
and (cos(angle), sin(angle)) / 1.5
Fixed edges:
(0, 1)
(1, 2)
...
(10, 11)
(11, 0)
and
(12, 13)
(13, 14)
...
(22, 23)
(23, 12)
@stla To my knowledge trigonometric functions are not bit to bit portable. Can you trigger different triangulation outcomes when pre-computing and hard-coding vertex positions?
I don't know, I don't have a Mac. (not sure to understand your question actually)
The trigonometric coordinates are calculated in R, not in C++. Do you think there can be some differences depending on the OS?
Yes, different results of sin/cos depending on a platform. Try computing and saving coordinates on one platform and hard-code them as an input. Hope it’s clear now.
@stla FYI I am going to close this issue as not reproducible soon.
Hello,
I did a R package wrapping CDT. When submitting a R package for publication, it is tested with multiple OS. A unit test fails on Mac. The results of a constrained Delaunay triangulation are not the same as the ones obtained on Windows and Unix (the edges are not the same). Does it make sense? The constrained Delaunay triangulation is not unique, is it? But how is it possible to get different results depending on the OS? The algorithm is deterministic, isn't it?