Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

## vsldConvExecX in 2D/3D

Beginner
276 Views
Hello all,
Is there an example code for 2D or 3D convolution using vsldConvExecX? I am not sure I understand the documentation (Ch. 10 in MKL doc.). It seems like I cannot pass a dynamically allocated 2D array to vsldConvExecX. Is this correct? If so do I just pass a 1D array (with the usual pointer arithmetic to access elements in i,j fashion?)? If so what do the strides and shapes look like?

I have something like this
.........

MKL_INT rank,mode,xshape[2],yshape[2],zshape[2];
static double x[sx*sx],y[sy*sy],z[sz*sz];
MKL_INT xstride[2],ystride[2],zstride[2];
int status,i;

xshape[0] = xshape[1] = sx; yshape[0] = yshape[1] = sy; zshape[0] = zshape[1] = sz;

xstride[0] = 1; xstride[1] = sx; ystride[0] = 1; ystride[1] = sy; zstride[0] = 1; zstride[1] = ??

for (i=0; i<(sx*sx); i++)
x=i*i;
for (i=0; i<(sy*sy); i++)
y = 1;

rank = 1;
mode = VSL_CONV_MODE_AUTO;

...

........

I am unsure what zstride[1] will be. Also, I am thinking that sz would be the same size as the input signal, is this ok?

Please let me know if I am messing up the code real bad and what is the correct way to proceed.

C.S.N

1 Solution
New Contributor I
276 Views

Hi C.S.N.

// First of allI recommend set
rank=2; //It's 2D problem

// Also
sz = sx + sy - 1; //sznot equal to sx or sy; szequal or more then sx + sy - 1
zstride[1] = sz;

Best regards
Victor

3 Replies
Employee
276 Views

Pleaserefer the VSL convolution examples provided in the /examples/vslc/source folder.

--Vipin

New Contributor I
277 Views

Hi C.S.N.

// First of allI recommend set
rank=2; //It's 2D problem

// Also
sz = sx + sy - 1; //sznot equal to sx or sy; szequal or more then sx + sy - 1
zstride[1] = sz;

Best regards
Victor

Beginner
276 Views
Hello Victor and vipin,
thanks for the response.

Vipin, there are no multidimensional example provided! In fact vslConvExecX is used on a 1d array!

Victor, sorry for the spasm! Of course it should be (sx-1) + (sy-1) + 1 and yes thanks for pointing out the rank = 2 and zstride. I changed them as suggested. The last few pages on the doc I didn't read too thoroughly were very useful! Also had to change to vsldConvNewTaskX from vsldConvNewTask!!

Best,

C.S.N