0

I'm trying to use openmp to run the below code, but I get Segmentation Fault

void modKeyGenPrs(mat_GF2E *&Prs, mat_GF2E Lst[], mat_GF2E L1, mat_GF2E L2) {
    Prs = new mat_GF2E[m];
    mat_GF2E L1_trans = transpose(L1);
        #pragma omp parallel shared(L1_trans,L2,Lst,Prs,L1) 
        {
               #pragma omp for
               for (int i = 0; i < m; i++) {
                   (Prs[i]).SetDims(n, n);
                   for (int j = 0; j < m; j++) {
                       Prs[i] = Prs[i] + (L2[i][j] * (L1_trans * (Lst[i]) * L1));
                   }
               }
       }
} 
8
  • are you sure you wish to use "#pragma omp parallel for" inside a parallel region; just use "#pragma omp for" Jun 25, 2014 at 17:17
  • Try to run it in a debugger. Also, you got nested parallelism; use #pragma omp for within a parallel region, or use #pragma omp parallel for without an outer #pragma omp parallel.
    – Sedenion
    Jun 25, 2014 at 17:23
  • I edit my code with your suggestion by I get the same error, I use a debugger and I obtain No source available for "NTL::mul() at 0x7ffff7a6ba0d
    – user46060
    Jun 25, 2014 at 17:41
  • Use the debugger to get the stack trace and therefore the position in your code where the program breaks. Your error message indicates that you use NTL incorrectly (because it stops in a library function). "No source" means that, well, the debugger can't find the source-code of the library. Also, does the program run fine without OpenMP?
    – Sedenion
    Jun 25, 2014 at 17:52
  • @Gugi without OpenMP the program works, about NTL I think that my debugger need NTL configuration.
    – user46060
    Jun 25, 2014 at 17:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.