-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with optimized build compiled with Intel C/C++ compiler (ICC) #217
Comments
Thanks for the report. There was a similar error several years ago due to lack of accuracy in some implementations of atan2, but that was several orders of magnitude smaller than the results you are seeing. Also, the test values are supposed to be generated by a fixed pseudorandom number generator that's part of Imath, but the failing values I see in your log don't show up in a good run. If you have time, could you add a few lines to testRandomAngles() in testExtractEuler.cpp to emit the value of the Eulerf object and the Matrix M before the "small random error" is added to it? While you're at it, you could also change the assert(false) to an abort() so that the test will stop at the first failure. I presume you've built with -DNDEBUG so that the assert is compiled out. |
Thanks for the prompt reply. I modified testExtractEuler.cpp with the changes you described. Here's the output from ImathTest after making the changes: ImathTest_log.txt |
Ok, one minor mystery solved. The code that generates the random euler angles for testing is sensitive to the evaluation order of function arguments, which is undefined. That explains why the case that fails for you didn't show up in my run, but even when I test that case, I get a good result. Here's the output with some more intermediate values printed. I can see that the initial conversion from euler angles to a rotation matrix is off by a few bits, suggesting a possible issue with trig function accuracy. It could be worth looking at this and trying some floating point options: https://software.intel.com/sites/default/files/managed/a9/32/FP_Consistency_070816.pdf |
Good to know. Given that we aren't seeing any issues with our application after upgrading to the latest Intel compiler I'm going to hold off on investigating this further for now. I appreciate your input. |
Looking into the OpenEXR issue backlog. It seems this may have resolved itself, is there any further action needed here? If not, I'll close the issue. |
Closing the issue for now, feel free to re-open or file a new issue if you need further help. |
I'm developing an application that uses the vector and matrix classes from IlmBase. I use Intel's C/C++ compiler and noticed recently that some part of my code involving Imath::Matrix44 did not produce the correct output. I found that if I set values in the matrix via setTranslation() and scale() and then view the contents of the matrix, some of the elements contain unexpected values. This only occurred in non-debug builds and when I attempted to step through the code with the debugger, the code where the problem appeared to occur was optimized away and not visible in the debugger.
I tried building and running ImathTest and found that when built with the initial release of ICC 17 and either -O2 or -O3 optimization flags, the test fails. I upgraded to ICC 17 update 1 and found that my application no longer exhibited the issue at any optimization level however ImathTest still fails when built with -O3 optimization. I’ve attached the output from the failing test; when the test fails, it continues to print “unexpectedly large matrix to euler angles conversion error” followed by a printout of a matrix indefinitely until terminated.
Given that I’m not seeing the issue in my application any more, it doesn’t seem too critical. However it suggests something in Imath may rely on undefined behavior that causes failure when compiled with -O3 optimization. ImathTest runs successfully when compiled with gcc and -O3, alternatively suggesting that this might be an issue with the Intel compiler however I haven’t tried to investigate this possibility.
I've attached compilation and execution logs for different build configurations. Running the release build of ImathTest fails while the other builds run successfully.
ImathTest_Release_run_log.txt
ImathTest_Debug_run_log.txt
ImathTest_RelWithDebInfo_run_log.txt
ImathTest_Release_build_log.txt
ImathTest_Debug_build_log.txt
ImathTest_RelWithDebInfo_build_log.txt
The text was updated successfully, but these errors were encountered: