- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
my code is this:
__________________________________________
#include <iostream>
class TEST{
public:
double *A;
public:
TEST(double * _A){
A = _A;
#pragma offload_transfer target(mic:0) nocopy(this : alloc_if(1) free_if(0)) in(A:length(2*3) alloc_if(1) free_if(0))
}
void run(){
A[1] = 0;
// double *B = A;
std::cout<<A[1]<<std::endl;
#pragma offload target (mic) nocopy(this : alloc_if(1) free_if(0)) out(A:length(2*3) alloc_if(0) free_if(1))
{
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();
}
______________________________________________________
I want to copy the matrix A in TEST constructor first,and then in run() using it.but it give me some error when I compile the code
------------------------------------------------------------
$ icpc testclass.cpp
testclass.cpp(9): internal error: bad pointer
#pragma offload_transfer target(mic:0) nocopy(this : alloc_if(1) free_if(0)) in(A:length(2*3) alloc_if(1) free_if(0))
^
compilation aborted for testclass.cpp (code 4)
--------------------------------------------------------------
could someone help me figure out what wrong with this ,thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will try reproducing the error and post again when I know more.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
NOTE: This post was Updated after my original post.
I reproduced the internal error and forwarded it to Development (see internal tracking id below).
After checking with Developers much more knowledgeable than me with C++ and offloading a CLASS member pointer, I removed my earlier code and provided their corrected code below. Unfortunately their variant is still similar to your code and still suffers the internal error with the Parallel Studio XE 2015 Update 2. I have verified there is a fix in our latest internal development compiler but I need to check whether it will make the upcoming Parallel Studio XE 2015 Update 3 release.
(Internal tracking id: DPD200368511)
#include <iostream> #include <stdio.h> class TEST{ public: double *A; public: TEST(double * _A){ A = _A; // #pragma offload_transfer target(mic:0) nocopy(this : alloc_if(1) free_if(0)) in(A:length(2*3) alloc_if(1) free_if(0)) // Allocate the object #pragma offload_transfer target(mic:0) nocopy(this: alloc_if(1)) // Use existing object, and allocate A in it #pragma offload_transfer target(mic:0) nocopy(this) in(A:length(2*3) alloc_if(1) free_if(0)) } void run(){ A[1] = 0; // double *B = A; std::cout<<A[1]<<std::endl; // #pragma offload target (mic) nocopy(this : alloc_if(1) free_if(0)) out(A:length(2*3) alloc_if(0) free_if(1)) // Refresh "this" pointer in this offload #pragma offload target (mic) in(this: length(0) alloc_if(0) free_if(0) ) out(A:length(2*3) alloc_if(0) free_if(1)) { 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(); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The internal error is fixed in PSXE 2015 update #3, so I'm closing this ticket now.
Patrick (covering for Kevin)
C:\Users\pbkenned\ISN\U544988>icl U544988.cpp -GR-
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.3.208 Build 20150407
Copyright (C) 1985-2015 Intel Corporation. All rights reserved.
U544988.cpp
Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:U544988.exe
U544988.obj
C:\Users\pbkenned\AppData\Local\Temp\5\6884173.obj
-defaultlib:liboffload
-defaultlib:libiomp5md
ofldbegin.obj
ofldend.obj
C:\Users\pbkenned\ISN\U544988>U544988.exe
0
1
C:\Users\pbkenned\ISN\U544988>
![](/skins/images/3344F5B3B76C91485ED0E980FD0CA95E/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page