Community
cancel
Showing results for 
Search instead for 
Did you mean: 
imanh
Novice
114 Views

Intel MKL (VSL) Correlation 2d error

Jump to solution

I'm trying to do a 2D correlation, I get VSL_CC_ERROR_YSHAPE, or VSL_CC_ERROR_DECIMATION for any combination of possible code! I saw an example here: community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/2D-convolution-using-VSL-Conv/m-p/1007237#M18992 (even the same exact example throws decimation error for me), and here is my code:

"""

MKL_INT xshape[2] = { 128,128 }, yshape[2] = { 3,3 }, zshape[2] = { xshape[0]+yshape[0]-1,xshape[1]+yshape[1]-1 };

status = vslsCorrNewTask(&task, mode, rank, xshape, yshape, zshape);
if (status != VSL_STATUS_OK) {
printf("ERROR: creation of job failed, exit with %d\n", status);
return;
}

status = vslsCorrExec(task, x, NULL, y, NULL, z, NULL);
if (status != VSL_STATUS_OK) {
printf("ERROR: job status bad, exit with %d\n", status);
return;
}

"""
I tried setting vslConvSetStart (set start to [0,0]) -> didnt work
tried setting all the strides to: [1,1] or to [Xshape[1],1] for X \in {x,y,z}
Any combination of the above doesn't work as well.

0 Kudos
1 Solution
MRajesh_intel
Moderator
62 Views

Hi,

 

These are the Visual Studio(V16.9.4) settings (attached image below) which ran the sample and the result (attached image below).

 

Can you also please specify your visual studio version ?

 

Regards

Rajesh.

 

 

View solution in original post

5 Replies
MRajesh_intel
Moderator
88 Views

Hi,

 

The code ran successfully on our end. I used the command: icpc -mkl example.cpp to compile. I am using oneAPI 2021.2 version . Can you please specify your compiler, OS, oneAPI version, so we can reproduce from our end ?

 

And also here is the sample I tried:

 

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "mkl.h"

int main()
{
    VSLConvTaskPtr task;
    
    MKL_INT f_shape[] = { 128, 128};
    MKL_INT g_shape[] = { 3, 3 };
    MKL_INT Rmin[] = { 0, 0 };
    MKL_INT Rmax[] = { f_shape[0] + g_shape[0] - 1, f_shape[1] + g_shape[1] - 1 };
    MKL_INT h_shape[] = { Rmax[0], Rmax[1] };
    MKL_INT h_start[] = { 0, 0 };


    MKL_INT f_stride[] = { f_shape[1], 1 };
    MKL_INT g_stride[] = { g_shape[1], 1 };
    MKL_INT h_stride[] = { h_shape[1], 1 };
    
    double *f = new double[ f_stride[0] * f_shape[0] ];
    double *g = new double[ g_stride[0] * g_shape[0] ];
    double *h = new double[ h_stride[0] * h_shape[0] ];

    for(int i=0; i < f_shape[0]; ++i)
        for(int j=0; j < f_shape[1]; ++j)
            f[ i * f_stride[0] + j ] = 1;

    for(int i=0; i < g_shape[0]; ++i)
        for(int j=0; j < g_shape[1]; ++j)
            g[ i * g_stride[0] + j ] = 1;

    memset( h, 0, sizeof(h[0]) * h_stride[0] * h_shape[0] );

    int status;
    status = vsldConvNewTask( &task, VSL_CONV_MODE_AUTO, 2, f_shape, g_shape, h_shape );
    assert(status == VSL_STATUS_OK);

    status = vslConvSetStart( task, h_start );
    assert(status == VSL_STATUS_OK);

    status = vsldConvExec( task, f, f_stride, g, g_stride, h, h_stride );
    assert(status == VSL_STATUS_OK);

    status = vslConvDeleteTask(&task);
    assert(status == VSL_STATUS_OK);
    
    for (int i=0; i< h_shape[0]; ++i)
    {
        printf("%3i: ",i);
        for (int j=0; j < h_shape[1]; ++j)
        {
            printf("%4.0f ",h[ i * h_stride[0] + j ]);
        }
        printf("\n");
    }
    return 0;
}
 

 

 

Regards

Rajesh.

 

 

imanh
Novice
84 Views

I ran this, and I get all 0s. (the problem is not that it does not run, in this case it does run, but all results are 0)

MRajesh_intel
Moderator
63 Views

Hi,

 

These are the Visual Studio(V16.9.4) settings (attached image below) which ran the sample and the result (attached image below).

 

Can you also please specify your visual studio version ?

 

Regards

Rajesh.

 

 

View solution in original post

imanh
Novice
51 Views

VS2019. My settings are the same EXCEPT for:

User interface: DPC++ API (instead of ILP64)

Use oneMKL: Sequential (but this doesn't matter)

: SO I tried and "ILP64" fixed it. But is this okay? I mean, no warning, no compilation error, just results being wrong when you use the wrong interface?

And I found this on ILP64 vs LP64, but I cant find anything about DPC++ API vs (I)LP64.

Thank you.

 

MRajesh_intel
Moderator
23 Views

Hi,


Thanks for the confirmation. DPC++ API should be selected if you have DPC++ source code; when working with multiple devices (CPU/GPU) ,using device-specific libraries underneath.


You may try oneMKL DPC++ samples using DPC++ API.


For further reference: https://github.com/oneapi-src/oneMKL


Regards

Rajesh.



Reply