- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I'm optimizing an application with Xeon Phi 5110P. And its initialization part looks as below:
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct { float *W[7]; float *B[7]; //float *dW[7]; //float *dB[7]; } net; int main(int argc, char *argv[]) { int a[8]; a[:] = 1024; //a[:] = 64; int arr1[7], arr2[7]; arr1[0:7] = a[0:7]*a[1:7]; arr2[0:7] = a[1:7]; net n1; for(int i=0; i<7; i++) { n1.W = new float[arr1]; memset(n1.W, 0, arr1*sizeof(float)); #pragma offload_transfer target(mic:0) in(n1.W:extent(0:arr1) alloc_if(1) free_if(0)) n1.B = new float[arr2]; memset(n1.B, 0, arr2*sizeof(float)); #pragma offload_transfer target(mic:0) in(n1.B:extent(0:arr2) alloc_if(1) free_if(0)) } //calculation on phi #pragma offload_transfer target(mic:0) out(n1.W[0:7]:extent(0:arr1[0:7]) alloc_if(0) free_if(1)) #pragma offload_transfer target(mic:0) out(n1.B[0:7]:extent(0:arr2[0:7]) alloc_if(0) free_if(1)) return 0; }
In the initialization step, I tried to allocate memory for the arrays of pointers on the host and transfer data to Phi. If I set the elements of array a with 64, the program runs correctly. But when I tried to set array a as 1024 as above, the program gives "offload error: allocation (base=0x10d6010, size=8388608) overlaps with existing allocation (base=0xcd6000, size=8388608)".
I'm wondering whether this problem comes from memory size limits or other reasons.
I'd appreciate if someone could help to explain this problem. thx
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The larger size and offload allocation overlap error probably relate to exhausting available resources on the coprocessor. I can reproduce that scenario but at smaller sizes (even <64) I experience a segmentation fault. You did not mention seeing that though. I have to check with others on this.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page