943,752 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1520
  • C++ RSS
Jun 26th, 2009
0

Loop was vectorized

Expand Post »
I don't know how to solve this problem in my code

voro.cpp(200): (col. 5) remark: LOOP WAS VECTORIZED
voro.cpp(395): same problem
voro.cpp(423):
voro.cpp(427):

I am using intel compiler 10.1 to compile my code

the code works fine on dev C++ 4.9.9.2 and V C++ 2008



200
C++ Syntax (Toggle Plain Text)
  1. for(j=0; j<3; j++)
  2. {
  3. orient_norm[i][j] = orient[i][j]/len;
  4. }

395
C++ Syntax (Toggle Plain Text)
  1. for(i=0; i<4; i++) // Normalise
  2. quat[i] /= qlen;

423
C++ Syntax (Toggle Plain Text)
  1. for(j=0; j<3; j++)
  2. ori_rot[i][j] = orient_norm[i][0]*q_matrix[0][j] + orient_norm[i][1]*q_matrix[1][j] + orient_norm[i][2]*q_matrix[2][j];

427
C++ Syntax (Toggle Plain Text)
  1. for(j=0; j<3; j++)
  2. bas_rot[i][j] = basis[i][0]*q_matrix[0][j] + basis[i][1]*q_matrix[1][j] + basis[i][2]*q_matrix[2][j];


Thank you for your time
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nahmartin is offline Offline
12 posts
since Jun 2009
Jun 26th, 2009
0

Re: Loop was vectorized

It's only a hint that the compiler generated code which can be executed parallely, IIRC.
Reputation Points: 395
Solved Threads: 71
Posting Whiz
jencas is offline Offline
362 posts
since Dec 2007
Jun 26th, 2009
0

Re: Loop was vectorized

sorry my c++ knowledge is self taught

thank you

when i run the code it will randomly crash with

segmentation fault (i thought this was linked to the compiler remark)
Last edited by nahmartin; Jun 26th, 2009 at 8:19 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nahmartin is offline Offline
12 posts
since Jun 2009
Jun 26th, 2009
0

Re: Loop was vectorized

When one vectorized their code the idea is to have the three or four components processed side by side.

Re-examine your loops as you have a problem. They're all exclusive but some are {0...2} and some are {0...3} for XYZ and XYZW processing. Was that intentional?

You haven't shown your declarations so difficult to tell if you're out of range thus causing your segmentation fault.

Also you only show snippets but do a pre-divide by zero check! Typically in vectors you're just not dividing a vector by a scalar. You are generating a product by multiplying a vector by a reciprocal scalar. If that is the case, if the divisor (typically a magnitude) is very close to zero, then don't do the 'division'. As the divident approaches zero, the result of the reciprocal-square root is negligible thus use the algebraic multiplicative identity (N = N * 1) thus N = N.
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Jun 27th, 2009
0

Re: Loop was vectorized

thank you wildgoose

the loops were intentional one is position the other rotation (quaternions)

I have checked for for

pointing to un-initialised variables
and
pointing to outside of allocated vectors and matrices

what else would cause a segmentation fault

i do have this

Quote ...
string style;
char* output_file;

style = argv[1];
output_file = argv[14];
would either cause a segmentation error (Unfortunately i get this error at university using the icc 10.1 compiler so i cannot check myself)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nahmartin is offline Offline
12 posts
since Jun 2009
Jun 27th, 2009
0

Re: Loop was vectorized

argv[] You really have 14 command line arguments? [0] is path.

In your matrics [][] you show i as an index but you don't show what it is set to! I'm assuming it contains a valid index?

Other then that I don't spot an indexing error. Provided your vectors are [4] and [4][4].
This is a good time to also make sure your vector's and matrices are properly aligned. The first step is Pseudo Vector code such as you're doing now. The next logical step is using SIMD (Single-Instruction Multiple Data) operands (Assembly Language).
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: GetAsyncKeyState() work in other operating systems?
Next Thread in C++ Forum Timeline: C++ Application Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC