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

MKL VSL 2D Convolution - Wrong answer with no error message

hari_muc
New Contributor I
2,107 Views

Hello,
I am trying a minimum working example of MKL VSL 2D Convolution in ifx v2024.0.0.

I'm running MKL v2024.0.0 (installed with Base toolkit v2024.0.0), using Visual Studio 2022 on windows 10.

I'm trying to convolve two matrices of random numbers, each with 100x100 & 25x25 elements. A stride of [1,1] is chosen, since I want the output to also be 100x100.

It builds & runs without errors but output is always zero.

3 or 4 different forum pages here report a similar problems & the suggested solutions have been tried out.

Visual Studio project settings are set to choose MKL Parallel, ILP64.
I'm using additional linker options: mkl_intel_ilp64_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib

 

Some advice on this problem will be very helpful!

 

0 Kudos
6 Replies
JilaniS_Intel
Employee
2,075 Views

Hi,



Thanks for posting in Intel communities.


The issue reproduced at our end and we will get back to you soon with an update.



Regards,

Jilani


0 Kudos
JilaniS_Intel
Employee
1,989 Views

Hi Srihari Srinivasan,

 

 

Thank you for sharing the detailed description of the issue and your requirements. It helps us to better understand the problem.

 

The strides in the reproducer are not set correctly. Since a 2D array is used, if you expect to use each element, then the stride should be set to 1, <number of element in the first dimension> so for a matrix of size 100x100 it should be set to 1,100.

 

After updating the stride value from [1, 1] to [1, n], for example update the stat.

 

stat = vslsconvexec(taskonv,x,[1,1],f,[1,1],y,[1,1])

to 

stat = vslsconvexec(taskonv,x,[1,n],f,[1,lop],y,[1,n])

 

The results aren't 0 anymore.

Please use the attached sample code after correcting stat and let us know whether the issue has been resolved or not?". Thank you.

 

 

Regards,

Jilani

 

0 Kudos
hari_muc
New Contributor I
1,973 Views

Hello Jilani,

Thank you very much for pointing out my mistake!

I corrected them but still the output of  variable y, which is supposed to be the output is still all zeroes. I've tried your code and the output variable is still all zeroes. 

The problem is not solved. 

In your modified code, you print out the variable  VSL_STATUS_OK, which always seems to show 0.
In my original code, I had printed out the 'stat ' return variable after calls to vslsconvnewtask, vslconvsetstart, vslconvsetinternalprecision & vslsconvexec. 
In my original code, it showed an error code -2312 after calling vslsconvexec. 

Now if I modify your code to print only the 'stat ' return variable 4 times, as tested earlier. I get an error code -2311 after calling vslsconvexec.

 
I don't understand why. I also don't find the list of error codes anywhere in the documentation or on the Intel website. 
Could you please help me understand what is this 'stat ' return variable used for, if output status is checked only with VSL_STATUS_OK?

 

I have commented out the lines where the two input matrices are also printed. That could mislead one into thinking the output is ok. Instead I'm printing out only the output matrix y, & the the 'stat' return variable. 

 

I've attached your code, with minor changes and the console output. 

Thank you!

 

Srihari

0 Kudos
JilaniS_Intel
Employee
1,892 Views

Hi Srihari Srinivasan,

 

 

>> After updating the stride value from [1, 1] to [1, n], for example update the stat " convolve_2D_example_CodeChanges.f90 "

 Following the adjustment of the stride value from [1, 1] to [1, n], there is no observation of zeros Matrix. Please find attached log report "Output_log.txt" .

 

>> I have commented out the lines where the two input matrices are also printed. That could mislead one into thinking the output is ok. Instead I'm printing out only the output matrix y, & the the 'stat' return variable. " convolve_2D_example_CodeChanges_v1.f90 " .

We executed the "convolve_2D_example_CodeChanges_v1.f90" and examined the resulting output. It does not display zeros for the matrix Y. Please find attached log report " Output_log_v1.txt "

 

>> I've attached your code, with minor changes and the console output .

I have checked the contents of (console_output.txt), and it indicates that Matrix y contains zeros. However, in our execution, we are not observing zeros in Matrix y. Please refer " Output_log_v1.txt ". Please review both the attached reports.

 

 

Could you please try to run the "Intel oneAPI command prompt for Intel 64 for Visual Studio 2022" command prompt .

 

 

Please refer to the below Developer Reference link for stride parameters.

https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-fortran/2024-0/vslconvnewtaskx-vslcorrnewtaskx.html

 

 

Regards,

Jilani

 

0 Kudos
JilaniS_Intel
Employee
1,794 Views

Hi,



A gentle reminder:


We have not heard back from you. Could you please provide us with an update? Has the information provided successfully resolved your issue?



Regards,

Jilani


0 Kudos
JilaniS_Intel
Employee
1,741 Views

Hi,



A gentle reminder:


We have not heard back from you. Could you please provide us with an update? Has the information provided successfully resolved your issue?




Regards,

Jilani


0 Kudos
Reply