Software Archive
Read-only legacy content
17060 Discussions

Intel MIC - sum of intrinsic vector elements

H__Kamil
Beginner
522 Views

I have a __m512d intrinsic vector and I need sum of his elements. Is there any easy way to do this? I am concentrated on a performance of computation, so i need to do this operation quickly. My knowledge about intrinsic is not enough to do it yourself, so I need Your help.

Thanks :)

0 Kudos
1 Reply
TimP
Honored Contributor III
522 Views

It seems OK to use plain C++ .

#include <numeric>

union{

__m512d reg;

double dbl[8];

}array;

double sum = accumulate( &array.dbl[0]. &array.dbl [8], 0.);

 

0 Kudos
Reply