- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this simple test code is this(testclass.cpp):
#include <iostream>
class TEST{
public:
double *A;
public:
TEST(double * _A){A = _A;}
void run(){
A[1] = 0;
// double *B = A;
std::cout<<A[1]<<std::endl;
#pragma offload target (mic) inout(A:length(2*3))
{
A[1] = 1;
}
std::cout<<A[1]<<std::endl;
}
};
int main()
{
double *A = (double*)_mm_malloc(sizeof(double)*2*3,64);
TEST test(A);
test.run();
}
.............................................................................................
after complile and run ,this give me this error:
[root@localhost yb]# icpc testclass.cpp
[root@localhost yb]# ./a.out
0
Segmentation fault (core dumped)
......................................................................
thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It relates to the underlying "this" pointer. I need to check with someone more knowledgeable about the requirements for offload within the CLASS, but for now add the additional nocopy clause as shown below to create an instance of the underlying "this" pointer.
#pragma offload target (mic) nocopy(this : alloc_if(1) free_if(0)) inout(A:length(2*3))

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