From: Matthias Maier Date: Fri, 5 Apr 2024 19:57:13 +0000 (-0500) Subject: Test: cgal/cgal_mesh_criteria: disable floating point exceptions X-Git-Tag: v9.6.0-rc1~399^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16858%2Fhead;p=dealii.git Test: cgal/cgal_mesh_criteria: disable floating point exceptions We trigger a (deliberate) floating point exception in the CGAL (header) library: ``` // The multiplications could produce some NaN, with 0 * inf. Replacing it with inf is safe. // min(x,y) (the order is essential) returns its second argument when the first is NaN. // An IEEE 754-2019 maximum could help. __m128d big = IA::largest().simd(); -> __m128d x1 = _mm_mul_pd(aa,bz); // {-ai*bi,as*bs} //x1 = _mm_min_pd(x1,big); // no NaN __m128d x2 = _mm_mul_pd(aa,c); // {-ai*bs,as*bi} x2 = _mm_min_pd(x2,big); // no NaN __m128d x3 = _mm_mul_pd(ap,bz); // {-as*bi,ai*bs} //x3 = _mm_min_pd(x3,big); // no NaN __m128d x4 = _mm_mul_pd(ap,c); // {-as*bs,ai*bi} x4 = _mm_min_pd(x4,big); // no NaN ``` Thus, disable floating point exceptions for the test. --- diff --git a/tests/cgal/cgal_mesh_criteria.cc b/tests/cgal/cgal_mesh_criteria.cc index 3ecde4ba7e..f150f591b5 100644 --- a/tests/cgal/cgal_mesh_criteria.cc +++ b/tests/cgal/cgal_mesh_criteria.cc @@ -65,6 +65,13 @@ test() int main() { + // CGAL uses hand-optimized AVX instructions for certain performance + // critical operations that can create (temporary) signalling NaNs and + // trigger a spurious floating point exception. Thus disable FE_INVALID: +#if defined(DEBUG) && defined(DEAL_II_HAVE_FP_EXCEPTIONS) + fedisableexcept(FE_INVALID); +#endif + initlog(); test(); }