Coder Social home page Coder Social logo

Windows fixes about emdna HOT 5 OPEN

nicocvn avatar nicocvn commented on September 3, 2024
Windows fixes

from emdna.

Comments (5)

nicocvn avatar nicocvn commented on September 3, 2024

Trace of the only test that fail on Windows (in BpGeometryFunctionsTest.dXiMatrix):

C:\Users\velin\Documents\emDNA.git\emDNA\tests\utest_BpGeometryFunctions.cpp(67): error: The difference between mm_dXi2(i,j) and dXi_mats[1](i,j) is 1.4554329963445412e-15, which exceeds Real(1E-15), where
mm_dXi2(i,j) evaluates to -0.011379443932765363,
dXi_mats[1](i,j) evaluates to -0.011379443932763907, and
Real(1E-15) evaluates to 1.0000000000000001e-15.

So missing the target by ~0.455e-15 ... might be some issues with inputs and rounding; need to take a look.

from emdna.

nicocvn avatar nicocvn commented on September 3, 2024

Instructions:

  • need to run build+install from the "Developer prompt" installed with Visual Studio
  • config: cmake -G"Visual Studio 16 2019" -A x64 -S .\emDNA.git\ -B .\emDNA-build\ -DCMAKE_BUILD_TYPE=Release (for latest visual studio otherwise generator needs to be adjusted)
  • then same commands

from emdna.

nicocvn avatar nicocvn commented on September 3, 2024

Link about fp contract in MSVC: https://docs.microsoft.com/en-us/cpp/build/reference/fp-specify-floating-point-behavior?view=msvc-160

Similarly Clang and GCC have the -ffp-contract option

from emdna.

nicocvn avatar nicocvn commented on September 3, 2024

So after further investigation I do not think the failing test on Windows is a big issue; here are the numbers for the value that fails with MSVC:

  • GCC on Linux and Apple Clang on macOS both compute: -0.011379443932764877
  • on Windows using Visual Studio 16 2019 toolchain the value is computed as: -0.011379443932763907

The difference is 9.7e-16 (the machine epsilon on the test setup is 2.22045e-16).

Looking at the computation of that value it is pretty heavy on trigonometric functions and expressions that are likely to be sensitivity to FMA type of optimization (fuse multiply add). It is likely that GCC/Clang and MSVC perform different types of optimizations.

Godbolt link: https://godbolt.org/z/W5nWTd MSVC seems to call some optimized sse2 library for cos and sin while GCC relies on a single call to get sin and cos.

Note that the reference value in the test was computed using Mathematica on macOS so it is also possible (likely) that this introduces some bias.

from emdna.

nicocvn avatar nicocvn commented on September 3, 2024

For now the test is disabled on MSVC.

from emdna.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.