c++ccilkcilk-plus

Why does it gives segmentation fault in cilk, I am using ICC compiler


I am new to programming in cilk. I am trying block matrix multiplication using cilk. But for some reason I am getting segmentation fault. Could you please help me on this.

void cilk_vec_mmm(int m, int n, int p, float A[m][1000], float B[p][1000], float C[m][1000]) 
   {
    int s=50;
           for(int i=0;i<m;i+=s)
          {
                for(int j=0;j<p;j+=s)
               {
                   for(int k=0; k<n;k+=s)
                  {
                   C[i:i+(s-1)][j:j+(s-1)]+= A[i:i+s-1][k:k+s-1]*B[k:k+s-1][j:j+s-1];
                  }
               } 
          }
   }

Solution

  • The subscripts are wrong. In Cilk Plus, [m:n] means subscripts m, m+1, m+2, ... m+n-1, which is different than the similar (m:n) notation in Fortran90.