- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Suppose I have a 2-dimensional array a
If VML can't support 2D array, is there any other libraries which could support calculate between 2D arrays?
Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you question mostly relay to other question "how to work with pointer in C". Hope my small example will help you.
#include <stdio.h>
#include "mkl.h"
#define DIMX 10
#define DIMY 2
main()
{
double a[DIMY][DIMX],y[DIMX];
int i,j;
for(i=0;i<DIMX;i++)
{
((double *)(a))=i;
((double *)(a))[i+DIMX]=i+DIMX;
y=-1;
}
for(j=0;j<DIMY;j++)
{
for(i=0;i<DIMX;i++)
{
printf("%.2f ",a
}
printf("\n");
}
vdAdd(DIMX,(double *)a,&((double *)a)[10],y);
for(i=0;i<DIMX;i++)
{
printf("%.2f ",y);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you!
I also wonder that if I want to offload only the vdAdd line to the MIC,what should I claim before the line?
I thought it may be like this:
#pragma offload target(mic:0)in((double *)a,&((double *)a)[10]:length(DIMX)) inout(y_add:length(DIMX))
{
vdAdd(DIMX,(double *)a,&((double *)a)[10],y);
}
However,it doesn't work.
Could you help me with this?

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