Loop was vectorized

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jun 2009
Posts: 5
Reputation: nahmartin is an unknown quantity at this point 
Solved Threads: 0
nahmartin nahmartin is offline Offline
Newbie Poster

Loop was vectorized

 
0
  #1
Jun 26th, 2009
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
  1. for(j=0; j<3; j++)
  2. {
  3. orient_norm[i][j] = orient[i][j]/len;
  4. }

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

423
  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
  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
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 360
Reputation: jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice jencas is just really nice 
Solved Threads: 69
jencas jencas is offline Offline
Posting Whiz

Re: Loop was vectorized

 
0
  #2
Jun 26th, 2009
It's only a hint that the compiler generated code which can be executed parallely, IIRC.
If you are forced to reinvent the wheel at least try to invent a better one!

Please use code tags - Please mark solved threads as solved
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 5
Reputation: nahmartin is an unknown quantity at this point 
Solved Threads: 0
nahmartin nahmartin is offline Offline
Newbie Poster

Re: Loop was vectorized

 
0
  #3
Jun 26th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: Loop was vectorized

 
0
  #4
Jun 26th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 5
Reputation: nahmartin is an unknown quantity at this point 
Solved Threads: 0
nahmartin nahmartin is offline Offline
Newbie Poster

Re: Loop was vectorized

 
0
  #5
Jun 27th, 2009
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

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)
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: Loop was vectorized

 
0
  #6
Jun 27th, 2009
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).
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC