- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
currently I am working with OpenMP Accelerator Model and I would like use OpenMP offload for executing my application on KNC coprocessor. In my application I use #omp target data region to ensuring data reusing. However, as a result, during execution of my application I get following error: offload error: process on the device 0 was terminated by signal 11 (SIGSEGV). I am trying to reslove my problem, but I don't know how to do it. The way in which I use OpenMP #target constructs in my application presents simple code bellow.
#include <iostream>
#include <omp.h>
using namespace std;
int main()
{
const int size = 100000;
double* A = (double*) _mm_malloc(size * sizeof (double), 64);
double* B = (double*) _mm_malloc(size * sizeof (double), 64);
double* C = (double*) _mm_malloc(size * sizeof (double), 64);
for(int i=0; i<size; ++i)
{
A = B = i;
C = 0.0;
}
#pragma omp target data map(to:A[0:size]) map(to:B[0:size]) map(to:C[0:size])
{
for(int ts=0; ts<100; ++ts)
{
#pragma omp target
{
#pragma omp parallel for
for(int i=0; i<size; ++i)
{
C = B * A;
}
}
}
}
_mm_free(A);
_mm_free(B);
_mm_free(C);
return 0;
}
I compile my code using icpc 17.0.1 with -O3 and -qopenmp flags. What can be problem, and how to reslove it?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to add the same map clauses for A, B and C on the inner "omp target". That ensures that the pointers A, B, C are updated on the device.
Note that the actual data transfer of A, B and C is only done once, by the outer "target data"
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page