Skip to content

Commit

Permalink
Still trying to understand what happens with MacOS/M1
Browse files Browse the repository at this point in the history
- My code that replaces distances computed by Geogram with distances
computed by ANN is not correct, breaks in GARGANTUA mode (??)
- Displaying whether point indices are the same or not....
  • Loading branch information
BrunoLevy committed Jun 12, 2024
1 parent 1587fcd commit fd000a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/tests/test_nn_search/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,29 @@ int main(int argc, char** argv) {
// Recompute distance between i and nearest neighbors computed by geogram using
// ANN's distance function, because there can be tiny differences if the compiler
// does not optimize both functions the same way (happens on Mac/M1)
//
// --> Did not work, NOT UNDERSTOOD YET (probably need to play with compilation flags)
/*
for(index_t j=0; j < nb_neigh; ++j) {
index_t nn = neigh2[j];
sq_dist2[j] = annDist(
M.vertices.dimension(), M.vertices.point_ptr(i), M.vertices.point_ptr(nn)
);
}
*/

for(index_t j=0; j < nb_neigh; ++j) {
// Added tolerance: on Mac/M1 we got tiny differences,
// I think it is doing auto FMA here and there, to be
// checked.
if(sq_dist1[j] != sq_dist2[j]) {
// if(::fabs(sq_dist1[j] - sq_dist2[j]) > 1e-6) {
if(sq_dist1[j] != sq_dist2[j]) {
has_mismatch = true;
match = false;
Logger::err("Mismatch") << i << "[" << j << "]"
<< (sq_dist2[j] - sq_dist1[j])
<< " indices: "
<< neigh1[j] << " " << neigh2[j]
<< std::endl;
}
}
Expand Down

0 comments on commit fd000a7

Please sign in to comment.