- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to use local arrays in an OMP target region. If its size is dependent on a variable, the device will crash with a SIGSEGV "offload error: process on the device 0 was terminated by signal 11 (SIGSEGV)"
Code:
#include <stdio.h> #include <stdlib.h> int main (int argc, char *argv[]) { { int size=argc*100000; int ar[size]; int ar2[100000]; printf("Size host %lld %lld\n",sizeof(ar),sizeof(ar2)); #pragma omp target map(alloc:ar,ar2) printf("Size device %lld %lld\n",sizeof(ar),sizeof(ar2)); printf("Size worked\n"); #pragma omp target map(alloc:ar2) ar2[size-1]=55; printf("Static worked\n"); #pragma omp target map(alloc:ar) ar[size-1]=55; printf("Dynamic worked\n"); } return EXIT_SUCCESS; }
If you run this you get the output:
Size host 400000 400000 Size worked Static worked offload error: process on the device 0 was terminated by signal 11 (SIGSEGV)
Strangely: You can access lower entries (e.g. ar[0], ar[1]...) without problems (not sure if they are valid though) and using "10000" as the size does work (at least without a crash). Also doubling the size of ar2 works. Is this a compiler bug or do I have to use this as an array section? If so, can you point me to the OMP spec where this is explained?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apparently, the 15.0 beta compiler made an improvement here:
[tim@tim-wsm net]$ icc -openmp ag.c
[tim@tim-wsm net]$ ./a.out
Size host 400000 400000
Size worked
Static worked
Dynamic worked
Size device 400000 400000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page