Cannot compile double precision version on Ubuntu 16.04

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Cannot compile double precision version on Ubuntu 16.04

Postby oliver » Sun Sep 25, 2016 9:58 pm

I could not find any CMake options to enable a double precision build. However, the definition of dFloat in Newton.h, as well as
http://newtondynamics.com/forum/viewtopic.php?f=12&t=8862&hilit=double+precision
suggested to define ``_NEWTON_USE_DOUBLE``.

When I do that (ie adding `add_definitions(-D_NEWTON_USE_DOUBLE)` to the
CMakeList.txt file) then I get the following compile error:

newton-dynamics/coreLibrary_300/source/core/dgVector.h:1109:87: error: ‘_mm_cmpeq_epi64’ was not declared in this scope
return dgVector (_mm_castsi128_pd(_mm_cmpeq_epi64 (m_typeIntLow,
m_zero.m_typeIntLow)), _mm_castsi128_pd(_mm_cmpeq_epi64 (m_typeIntHigh,
m_zero.m_typeIntHi

I am on Ubuntu 16.04 (Intel CPU). How do I compile Newton with double precision?
oliver
 
Posts: 36
Joined: Sat Sep 17, 2016 10:31 am

Re: Cannot compile double precision version on Ubuntu 16.04

Postby Julio Jerez » Tue Sep 27, 2016 3:56 pm

I do not have Linux available, but the error seem to be on an unsupported function by you harwdware
I changed the function to this:

Code: Select all
   DG_INLINE dgVector TestZero() const
   {
      __m128i typeLow = _mm_cmpeq_epi64 (m_typeIntLow, m_zero.m_typeIntLow);
      __m128i typeHigh = _mm_cmpeq_epi64 (m_typeIntHigh, m_zero.m_typeIntHigh);
      return dgVector (_mm_castsi128_pd (typeLow), _mm_castsi128_pd(typeHigh));
      //      return dgVector (_mm_and_pd (_mm_cmpeq_epi64 (m_typeIntLow, m_zero.m_typeIntLow), m_signMask), _mm_and_pd (_mm_cmpeq_epi64 (m_typeIntHigh, m_zero.m_typeIntHigh), m_signMask));
   }


this will clarified if it is function _mm_cmpeq_epi64 or _mm_castsi128_pd
I am guessing is the second.
please try that and I can make the change to make sure it compile with lower architecture
Julio Jerez
Moderator
Moderator
 
Posts: 11046
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Cannot compile double precision version on Ubuntu 16.04

Postby oliver » Tue Sep 27, 2016 10:12 pm

Thank you for looking into this.

It turns out the problem is not with my hardware, but with a missing #include.
For some reason, `dgTypes.h` does not include `smmintrin.h` on Linux.

Once enabled, the engine compiles fine and `NewtonWorldFloatSize()` reports 8.
The PR is on GitHub, alongside another PR to enable double precision via a
CMake option.

In case it matters, my CPU is `Intel(R) Core(TM) i7-4712HQ`.

And just for fun, Newton also builds on an Ubuntu 14.04 AWS c4.large instance
(`Intel(R) Xeon(R) CPU E5-2666 v3`).
oliver
 
Posts: 36
Joined: Sat Sep 17, 2016 10:31 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest