Segmentation fault whith OMP 4.0 map of larger array

Segmentation fault whith OMP 4.0 map of larger array

When trying to offload an array that exceeds a specific size, the program fails with "offload error: process on the device 0  was terminated by signal 11 (SIGSEGV)"

Here is some test code. The first part works, the last not:

#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[]) {
  {
    int ar[3144000];
    printf("Size %lld\n",3144000);
    #pragma omp target data map(to:ar)
      printf("OK\n");
    printf("Back\n");
  }
  
  {
    int ar[3145000];
    printf("Size %lld\n",3145000);
    #pragma omp target data map(to:ar)
      printf("OK\n");
    printf("Back\n");
  }
  
  return EXIT_SUCCESS;
}

 

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Ok,  just found, that you only need to increase the default stack size with MIC_STACKSIZE=100M

But the error message is quite bad. Wouldn't it be possible to check/catch that and display something more helpful?

The message produced by the offload rtl reflects the actual error that occurred and was reported by the system. That error is essentially the same error that occurs on the host when a program exhausts the available shell stack space. On the host one sees only “Segmentation fault (core dumped)”. Unfortunately there is no way for the offload to know the issue relates specifically to insufficient stack space and report a different message.

Leave a Comment

Please sign in to add a comment. Not a member? Join today