- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
These are my program's simplification,because my source code is so tedious. // head.h class CTest { public: float * array1; float * array2; int Len1,Len2; CTest(); void do(); }; // head.cpp float * ptr1=0; float *ptr2=0; CTest:: CTest( ) { ..do something Len1 = something; array1=new float [Len1]; array1 assignment ..... ptr1=array; #pragma offload_transfer target(mic:0) in(ptr1:length(Len1) alloc_if(1) free_if(0)) signal(ptr1) ...do something Len2=something; array2=new float[Len2]; array2 assignment ... #pragma offload_transfer target(mic:0) wait(ptr1) in(ptr2:length(Len2) alloc_if(1) free_if(0)) } void CTest::do( ){ #pragma offload target(mic:0) nocopy(ptr1:length(Len1) alloc_if(0) free_if(0))\ nocopy(ptr2:length(Len2) alloc_if(0) free_if(0)) { while(1);// this is the key point ! do something .... } }
I have already found that the error message was thrown by "do" function."
the program will throw an error message: "address range partially overlaps with existing allocation"
I changed the function like this :
void CTest::do( ){ #pragma offload target(mic:0) nocopy(ptr1:length(Len1) alloc_if(0) free_if(0))\ nocopy(ptr2:length(Len2) alloc_if(0) free_if(0)) { } while(1);// this is the key point ! do something .... }
It works well !
I'm a Chinese student, sorry for the bad English taking to your inconvenience.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I fix the error :"address range partially overlaps with existing allocation"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It reports the error "address range partially overlaps with existing allocation", like below changing:
void CTest::do( ){ #pragma offload target(mic:0) nocopy(ptr1:length(Len1) alloc_if(0) free_if(0))\ nocopy(ptr2:length(Len2) alloc_if(0) free_if(0)) { printf("this message print out successfully \n");//used to debug } #pragma offload target(mic:0) { while(1);// this is the key point ! // the while(1) loop would not block this routine !? replace symbols used in next block for debugging,because offload clause don't include these symbol. ... do something .... } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my cases, this failure is suppressed by arbitrarily keeping length() below about 60MB, but I don't think anyone proposes this as a solution. It's been suggested (but not verified) that it may be due to older KNC hardware (e.g. KNC B0) not being the primary support target.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The offload that goes into an infinite loop on MIC is a synchronous offload, so once the CPU starts it, the program will block at that point.
If you make that offload asynchronous then you will observe execution proceeding past that point on the CPU, as shown by the print "Async offload successfully issued.
The program does block at program termination, waiting for all offloads to complete.
Here is the code:
#include <iostream> //These are my program's simplification,because my source code is so tedious. // head.h class CTest { public: float * array1; float * array2; int Len1,Len2; CTest(); void doit(); }; // head.cpp __declspec(target(mic)) float *ptr1=0; __declspec(target(mic)) float *ptr2=0; CTest:: CTest( ) { int Len1 = 10; array1=new float [Len1]; array1[0:10] = 1.0; //array1 assignment ptr1=array1; #pragma offload_transfer target(mic:0) in(ptr1:length(Len1) alloc_if(1) free_if(0)) signal(ptr1) //...do something // int Len2 = 10; array2=new float[Len2]; array2[0:10] = 2.0; //array2 assignment ptr2=array2; #pragma offload_transfer target(mic:0) wait(ptr1) in(ptr2:length(Len2) alloc_if(1) free_if(0)) } void CTest::doit( ) { #pragma offload target(mic:0) nocopy(ptr1:length(Len1) alloc_if(0) free_if(0))\ nocopy(ptr2:length(Len2) alloc_if(0) free_if(0)) signal(66) { while(1);// this is the key point ! // do something } } int main() { CTest *ct = new CTest; ct->doit(); std::cout << "Async offload successfully issued\n"; return 0; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim Prince wrote:
In my cases, this failure is suppressed by arbitrarily keeping length() below about 60MB, but I don't think anyone proposes this as a solution. It's been suggested (but not verified) that it may be due to older KNC hardware (e.g. KNC B0) not being the primary support target.
Hi, Tim. Thks for your proposes. There is a case below, it works well. This array size is 1GB. I just want to find out the error's source that"address range partially overlaps with existing allocation". #define LEN 4294967296 void print(int *p){ #pragma offload target(mic:0) in(p:length(LEN) alloc_if(1) free_if(1)) { for(int i=0;i<LEN;i++) p=p[i+1]+p; } } int main(){ int *p =new int[LEN]; print(p); return 0; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rajiv Deodhar (Intel) wrote:
The offload that goes into an infinite loop on MIC is a synchronous offload, so once the CPU starts it, the program will block at that point.
If you make that offload asynchronous then you will observe execution proceeding past that point on the CPU, as shown by the print "Async offload successfully issued.
The program does block at program termination, waiting for all offloads to complete.
Hi Rajiv, thank u very much .
I confused that the synchronous offload won't be blocked by an infinite loop. I want to find out where is my program's error coming from, so I added the infinite loop. But the infinite loop can not works well , the "do" function report "address range partially overlaps with existing allocation".
Many thanks for all things you have done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you all.
I have already fix the bug: "address range partially overlaps with existing allocation"
I put CTest class member variable into the offload scope and I forgot declaring it using offload-attribute(target(mic)).
I just assign these member variables to global variables, and declare these global variables using offload_attribute.

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