Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

using icpc, what is the best way to optimize the following code with AVX option?

$
0
0

I have a for loop to identify min and max of a float array. Here is my implementation:

for (int i = 0; i < counter; i++) {

     imin = intervals[i] < imin ? intervals[i] : imin;

     imax = intervals[i] > imax ? intervals[i] : imax;

   }

What is the best way to optimize the code here? I am using -xAVX option and I am running the program in single thread mode. How does this compare to using std::minmax_element? 

Should I write some manual AVX code?

Thanks,


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>