Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 415

Offloading an Array of pointer, SIGSEGV

$
0
0

Actually I want to offload a function call in an for-loop which I run in parallel with Openmp. The problem is, that I am able to run this loop in parallel or to offload the function call but not to do both at the same time. Every function call fills two arrays which are the only out clauses of the offload.

To run the loop in parallel I have two array of pointers to (int) output arrays, so that every parallel offload can save the output in an own array in according to this page: https://software.intel.com/en-us/articles/xeon-phi-coprocessor-data-transfer-array-of-pointers-using-language-extensions-for-offload

To give a better overview here the important part of the code which runs fine if I delete the offload pragma and run bar on the host:

foo() {
int *outa[threadnum], *outb[threadnum];
... // calc arrsize
   // here I want to insert #pragma omp for schedule...
   for () {
    outa[x] = (int *) malloc (arrsize * sizeof(int)); // x always between 0 and threadnum-1
    outb[x] = (int *) malloc (arrsize * sizeof(int));
    #pragma offload target(mic) \
    in(...)
    out( outa[x:1] : length(arrsize)
    out( outb[x:1] : length(arrsize)
    bar (...,outa[x],outb[x],...);
    ...
    free(outa[x]);
    free(outb[x]);
   }
}

Is there any obvious problem which I did not realize and leads to a Segmentation error (Happening in the really first offload, with x=0) ? For better comparison, here the part of the Code if I run the for loop not parallel on the phis (working fine):

foo() {
int *outa, *outb;

   for () {
   outa = (int *) malloc(arrsize * sizeof(int);
   outb = (int *) malloc(arrsize * sizeof(int);
   #pragma offload target(mic) \
   in(...)\
   out(outa:length(arrsize))
   out(outb:length(arrsize))
   bar(...outa,outb,...);
   ...
   free(outa);
   free(outb);
}

I appreciate every comment, if necessary I can try to create a Code-snippet to reproduce the error.

 

 


Viewing all articles
Browse latest Browse all 415

Trending Articles



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