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

for(j=0; j<3; j++)
    {
      orient_norm[i][j] = orient[i][j]/len;
    }

395

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

423

for(j=0; j<3; j++)
        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

for(j=0; j<3; j++)
        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

Recommended Answers

All 5 Replies

Member Avatar for jencas

It's only a hint that the compiler generated code which can be executed parallely, IIRC.

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)

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.

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)

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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.