- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everybody.
I have a pointer like this:
float **p = ...; ... #pragma offload target(mic) in(p[0]:length(...)) _FUNCITON_
Then I got error info: ` "p" may not be used in a subscript operation.` when compiling it.
So how could I pass a one-dimensional array like this to mic? any advice and suggestions will be greatly appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Declarations like float **p; are not supported. However, float *p
__declspec(target(mic)) float *p[4];
int main()
{
p[0] = malloc(4*sizeof(float));
p[1] = malloc(4*sizeof(float));
p[0][0] = 55.0;
p[0][1] = 66.0;
p[0][2] = 77.0;
p[0][3] = 88.0;
#pragma offload target(mic) in(p[0:1] : extent(0:4))
{
printf("p[0][0] = %f\n", p[0][0]);
printf("p[0][1] = %f\n", p[0][1]);
printf("p[0][2] = %f\n", p[0][2]);
printf("p[0][3] = %f\n", p[0][3]);
}
return 0;
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Declarations like float **p; are not supported. However, float *p
__declspec(target(mic)) float *p[4];
int main()
{
p[0] = malloc(4*sizeof(float));
p[1] = malloc(4*sizeof(float));
p[0][0] = 55.0;
p[0][1] = 66.0;
p[0][2] = 77.0;
p[0][3] = 88.0;
#pragma offload target(mic) in(p[0:1] : extent(0:4))
{
printf("p[0][0] = %f\n", p[0][0]);
printf("p[0][1] = %f\n", p[0][1]);
printf("p[0][2] = %f\n", p[0][2]);
printf("p[0][3] = %f\n", p[0][3]);
}
return 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Rajiv!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page