Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Trouble vectorizing pow()

jonnyz007
Beginner
223 Views
Hi - sorry this is my first day using icc so apologies if the obvious hasn't hit me yet!

I have a thermodynamic package written in C++ VS2010 which I have spent some time manually optimizing and got quite good results. However I thought I should try Intel C++ and see how the automatic vectorizing could work for me.

Simply put, all my thermo routines are similar to this:

for(i=0;i

{

H += r1f_nJ*pow(pi_g,r1f_I)*pow(tau_g,r1f_J-1);

}

where pi_g and tau_g are doubles calculated by the routine, and r1f_* are declared as follows in a header file:

const int r1f_I[34] = {0,0,0,0,0,0,0,0,1,1,1,1,1,1,2,2,etc...};

const int r1f_J[34] = {-2,-1,0,1,2,3,4,5,-9,-7,-1,0,1,3,-3,etc...};

const double r1f_nJ[34] = {-2.926594242633400e-001,8.454818716911400e-001,etc...};


Now I have enabled the compiler flag '-Qvec-report3' to see what's happening to my loops, and none are suitable for optimization! For the above I get the following warnings:

1>C:\\...\\Enthalpy.cpp(53,5): warning : loop was not vectorized: not inner loop.

1>C:\\...\\Enthalpy.cpp(55,6): warning : loop was not vectorized: unsupported loop structure.

1>C:\\...\\Enthalpy.cpp(55,6): warning : loop was not vectorized: unsupported loop structure.

I have tried the following:

for(i=0;i

{

HV = r1f_nJ*pow(pi_g,r1f_I)*pow(tau_g,r1f_J-1);

}

To keep all loops indepedent, but I still get the same warnings as above. My question is what am I doing wrong, as I would have expected the above for loop to vectorize easily.

Regards,
Jonathan

0 Kudos
0 Replies
Reply