- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider the following code:
#pragma omp parallel { #pragma omp single { #pragma omp task { printf("%d\n", half_size); /* bug */ #pragma omp target data map(to:values[0:half_size]) #pragma omp target #pragma omp parallel for for (i = 0; i < half_lists; ++i) sort(values, i, num_values); } } }
Without the printf statement and any other usage of the variable, 'half_size' within the target pragma is not recognized by the compiler as required within the 'omp task' block. In contrast, 'half_lists' and 'num_values' are properly copied as they are used in user code and not solely in a target pragma.
Thus, once the runtime hits 'omp target data map', half_size is not properly set, resulting in offload errors, e.g.
'offload error: address range partially overlaps with existing allocation'.
Tested with composer_xe_2013_sp1.2.144 (icc 14.0.2)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please help us with a complete (compilable) test code to reproduce the error?
Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One example code is this:
#include <stdio.h> #include <stdlib.h> int main (int argc, char *argv[]) { int half_size = 1000; int* values = (int*) malloc(sizeof(int)*half_size); int i; #pragma omp parallel { #pragma omp single { #pragma omp task { #pragma omp target data map(to:values[0:half_size]) #pragma omp target #pragma omp parallel for for (i = 0; i < half_size; ++i) values = i; } } } return EXIT_SUCCESS; }
If you try to run this, you get a segFault on the device. If you comment the #pragma omp task (note, that this does not change anything in this case) the example works.
I also got the error mentioned in the first post but I cannot reproduce it with a small sample. Will try and update as soon as I got something.
- 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