Software Archive
Read-only legacy content
17061 Discussions

_mm512_i32logather_pd

Dahai_G_
Beginner
490 Views

Hi, 

 

I am trying to use gather function in the follow code on MIC. When I ran it, it said "Segmentation fault". Can someone tell me how to fix it?

 

Thanks, 

 

#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <time.h>
#include <immintrin.h>

#define N 32

int main(){


   double a, b, c;

   for(int i = 0; i < N; i++)
   {
         a = 1.0*i;
         b = 2.0*i;
         c = -1.0;
   }

    int   index;
    for(int i = 0; i < N; i++) index = i;

     __m512i __cdecl vindex =  _mm512_load_epi32(index);

     __m512d __cdecl va =  _mm512_i32logather_pd(vindex, a,  1);
     _mm512_store_pd(c, va);

     for(int i = 0; i < N; i++) printf(" --- %f \n", c);


   return 0;

}

0 Kudos
7 Replies
Kevin_D_Intel
Employee
490 Views

I thought perhaps this was just a case of non-alignment and needing:
__attribute__ ( (aligned(64) )) double a, b, c;
__attribute__ ( (aligned(64) )) int index;
But there seems to be more. I'm checking with our intrinsic expert about this now.

0 Kudos
Dahai_G_
Beginner
490 Views

Thanks, Kevin. I seemed misunderstand the parameter  "scale in  _mm512_i32logather_pd. It should be set as "8" (not "1"), which seems mean byte position in memory. 

In addtiton,  do you know where I can find the code mentioned in https://software.intel.com/en-us/articles/the-intel-math-kernel-library-sparse-matrix-vector-multiply-format-prototype-package?

Dahai

 

0 Kudos
Kevin_D_Intel
Employee
490 Views

In addition to using correct alignment, the scale parameter in the gather intrinsic is incorrect. Since it gathers double elements it should be 8 instead of 1.
When I make both changes the test case runs correctly.

0 Kudos
Kevin_D_Intel
Employee
490 Views

Glad you were able to sort out the scale parameter.
The article says to email intel.mkl@intel.com to download the Intel MKL SpMV Format Prototype Package if that is the code you are interested in. If it is not then let me know and I can ping the MKL team for what you are interested in.

0 Kudos
Dahai_G_
Beginner
489 Views

I sent them an email to them about it several days ago. But no response ...

 

0 Kudos
Kevin_D_Intel
Employee
489 Views

Ok, I'm sorry about that. I will get their attention promptly.

0 Kudos
Sridevi_A_Intel
Employee
490 Views

sent the package to customer's email address

 

Thanks,

Sridevi

0 Kudos
Reply