Warning in CalculateJointsForceParalle

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Warning in CalculateJointsForceParalle

Postby arkeon » Sat Apr 18, 2015 11:14 am

Hello,

there is a warning in dgWorldDynamicUpdate::CalculateJointsForceParallelKernel
You use two i var in the for loops that could make things going badly.

Not sure if this can generate error here but it's worst to understand the code anyway :)
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Warning in CalculateJointsForceParalle

Postby Julio Jerez » Sat Apr 18, 2015 11:48 am

what do you mean by this, can you show me in the code?
arkeon wrote:Hello,
You use two i var in the for loops that could make things going badly.


I am making some changes to the solver, on that process I boosted something and I see lots of error, I am try to see what was it by comparing to 3.11

what is estrange is tat the error seem to be there long before I start making these changes.
I miss the old torstoi svn. it was so eassy to get older revision, github on want to make stupid Change list try to make of change every thing.

I never saw a source control system that you could not sync to an older version
Julio Jerez
Moderator
Moderator
 
Posts: 11040
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Warning in CalculateJointsForceParalle

Postby arkeon » Sat Apr 18, 2015 1:23 pm

hehe yes I have some difficulties with newer Git or bitbucket things too. I prefer keeping the good old svn. full change in code can be because someone or you used an editor that replace tabs by spaces and vice et versa so it recognize all the files as modified.

Here i is used in the 2 for

dgWorldDynamicUpdate::CalculateJointsForceParallelKernel
Code: Select all
static int xxx = 0;
xxx = 0;
   dgVector accNorm (syncData->m_accelNorm[threadID]);
   for (dgInt32 i = dgAtomicExchangeAndAdd(atomicIndex, 1); i < syncData->m_jointCount;  i = dgAtomicExchangeAndAdd(atomicIndex, 1)) {
      dgInt32 curJoint = jointInfoIndexArray[i].m_jointIndex;
      dgInt32 m0 = constraintArray[curJoint].m_m0;
      dgInt32 m1 = constraintArray[curJoint].m_m1;

//      syncData->Lock(m0, m1);
      dgSpinLock(&syncData->m_lock0, false);
      {
         dgInt32 test0 = 0;
         dgInt32 test1 = 0;
         if(m0) {
            test0 = syncData->m_bodyLocks[m0];
            syncData->m_bodyLocks[m0] = 1;
         }
         if (m1) {

            test1 = syncData->m_bodyLocks[m1];
            syncData->m_bodyLocks[m1] = 1;
         }

         if (test0 || test1) {
            // push on joint stack
xxx ++;
            for (dgInt32 i = dgAtomicExchangeAndAdd(atomicIndex, 1); i < syncData->m_jointCount;  i = dgAtomicExchangeAndAdd(atomicIndex, 1)) {
               curJoint = jointInfoIndexArray[i].m_jointIndex;
               m0 = constraintArray[curJoint].m_m0;
               m1 = constraintArray[curJoint].m_m1;
               if (!(syncData->m_bodyLocks[m0] | syncData->m_bodyLocks[m1])) {
                  break;
               }
               // push on joint stack
               xxx ++;
            }
            if (i >= syncData->m_jointCount) {
               Sleep(0);
               break;
            }
         }
      }
      dgSpinUnlock(&syncData->m_lock0);
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

Re: Warning in CalculateJointsForceParalle

Postby Julio Jerez » Sat Apr 18, 2015 4:14 pm

Oh I see, the for loop, I will change it thank you, for that. Good catch
That's the work I was doing to the Parallel solver, but it is no ready yet.
I though I had not committed that change yet, but apparently I did.
Julio Jerez
Moderator
Moderator
 
Posts: 11040
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Warning in CalculateJointsForceParalle

Postby arkeon » Sat Apr 18, 2015 6:54 pm

you're welcome
arkeon
 
Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 2 guests