Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29386 Discussions

Segmentation fault whith OMP 4.0 map of larger array

Grund__Aalexander
646 Views

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;
}

 

0 Kudos
2 Replies
Grund__Aalexander
646 Views

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?

0 Kudos
Kevin_D_Intel
Employee
646 Views

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.

0 Kudos
Reply