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

Uninitialised memory access in 'cblas_cgemm'

Chandrakant_19
Beginner
314 Views

Hi Intel Support Team,

I am working on a project using mkl library. I am using the 'cblas_cgemm' mkl routine for complex matrix multiplication.

I have initilaized the input parameters before before calling the api.


Code Snippet:
int m = 2, n = 2, k = 2;
int lda = 2, ldb = 2, ldc = 2;
MKL_Complex8 alpha = {1.0, 0.0};
MKL_Complex8 beta = {0.0, 0.0};

MKL_Complex8 A[4] = {};
MKL_Complex8 B[4] = {};
MKL_Complex8 C[4] = {};

A, B is overwritten with actual data.

cblas_cgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, &alpha, A,
lda, B, ldb, &beta, C, ldc);


On Intel Inspector in windows envirounment, we are observing following error

"Uninitialized memory access"

Thanking you.

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
135 Views

Checking the problem you reported with the current version of oneMKL ( 2024u1), I see no problem.

Here is the log file


$ valgrind --tool=memcheck --track-origins=yes --leak-check=full ./a.out cblas_cgemmx.d > 2.log 2>&1

============================


==1172046== Memcheck, a memory error detector

==1172046== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.

==1172046== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info

==1172046== Command: ./a.out cblas_cgemmx.d

==1172046== 


   C B L A S _ C G E M M EXAMPLE PROGRAM


   INPUT DATA

    M=2 N=4 K=3

    ALPHA =( 0.5, 0.0 ) BETA =( 1.2, 0.0 )

    TransA = CblasTrans TransB = CblasTrans  

    LAYOUT = CblasRowMajor  

    ARRAY A  LDA=2

     ( 1.00, 0.10)  ( 2.00, 0.00)  

     ( -3.20, 0.40)  ( -2.70, 1.10)  

     ( 0.00, 0.70)  ( 4.00, 0.00)  

    ARRAY B  LDB=3

     ( 1.00, -1.00)  ( 2.00, 2.30)  ( 3.00, 0.00)  

     ( 1.00, 1.00)  ( 2.00, 0.00)  ( 3.00, 0.80)  

     ( 1.00, -1.00)  ( 2.00, 0.60)  ( 3.00, 0.00)  

     ( 1.00, -1.00)  ( 2.00, 0.10)  ( 3.00, 0.10)  

    ARRAY C  LDC=4

     ( 0.00, 0.00)  ( 0.00, 0.10)  ( 1.00, 0.10)  ( 1.00, 0.00)  

     ( 0.00, 0.00)  ( 0.00, 0.10)  ( 1.00, 0.10)  ( 1.00, 0.00)  


   OUTPUT DATA

    ARRAY C  LDC=4

     ( -3.11, -2.68)  ( -3.03, 2.12)  ( -1.57, 0.16)  ( -1.51, 0.84)  

     ( 3.04, -3.01)  ( 4.30, 3.82)  ( 5.17, -0.59)  ( 5.45, 0.17)  ==1172046== 

==1172046== HEAP SUMMARY:

==1172046==   in use at exit: 11,803 bytes in 31 blocks

==1172046==  total heap usage: 99 allocs, 68 frees, 4,410,855 bytes allocated

==1172046== 

==1172046== LEAK SUMMARY:

==1172046==  definitely lost: 0 bytes in 0 blocks

==1172046==  indirectly lost: 0 bytes in 0 blocks

==1172046==   possibly lost: 0 bytes in 0 blocks

==1172046==  still reachable: 11,803 bytes in 31 blocks

==1172046==     suppressed: 0 bytes in 0 blocks

==1172046== Reachable blocks (those to which a pointer was found) are not shown.

==1172046== To see them, rerun with: --leak-check=full --show-leak-kinds=all

==1172046== 

==1172046== For lists of detected and suppressed errors, rerun with: -s

==1172046== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)



View solution in original post

0 Kudos
4 Replies
Gennady_F_Intel
Moderator
269 Views

It might be the same issue as you reported against Lapack cheev routine.  Which version of Inspector do you use? 

and again - is that oneMKL 2024u1? 

Could you show how do you link against oneMKL?

 

0 Kudos
Chandrakant_19
Beginner
233 Views

Hi,

 

Please find below details about compilers and libraries.

IntelSWTools (Linux) - compilers_and_libraries_2016.2.181

IntelSWTools (Windows) - compilers_and_libraries_2017.1.143

Intel Inspector 2023.0

 

Thanking You.

0 Kudos
Gennady_F_Intel
Moderator
136 Views

Checking the problem you reported with the current version of oneMKL ( 2024u1), I see no problem.

Here is the log file


$ valgrind --tool=memcheck --track-origins=yes --leak-check=full ./a.out cblas_cgemmx.d > 2.log 2>&1

============================


==1172046== Memcheck, a memory error detector

==1172046== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.

==1172046== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info

==1172046== Command: ./a.out cblas_cgemmx.d

==1172046== 


   C B L A S _ C G E M M EXAMPLE PROGRAM


   INPUT DATA

    M=2 N=4 K=3

    ALPHA =( 0.5, 0.0 ) BETA =( 1.2, 0.0 )

    TransA = CblasTrans TransB = CblasTrans  

    LAYOUT = CblasRowMajor  

    ARRAY A  LDA=2

     ( 1.00, 0.10)  ( 2.00, 0.00)  

     ( -3.20, 0.40)  ( -2.70, 1.10)  

     ( 0.00, 0.70)  ( 4.00, 0.00)  

    ARRAY B  LDB=3

     ( 1.00, -1.00)  ( 2.00, 2.30)  ( 3.00, 0.00)  

     ( 1.00, 1.00)  ( 2.00, 0.00)  ( 3.00, 0.80)  

     ( 1.00, -1.00)  ( 2.00, 0.60)  ( 3.00, 0.00)  

     ( 1.00, -1.00)  ( 2.00, 0.10)  ( 3.00, 0.10)  

    ARRAY C  LDC=4

     ( 0.00, 0.00)  ( 0.00, 0.10)  ( 1.00, 0.10)  ( 1.00, 0.00)  

     ( 0.00, 0.00)  ( 0.00, 0.10)  ( 1.00, 0.10)  ( 1.00, 0.00)  


   OUTPUT DATA

    ARRAY C  LDC=4

     ( -3.11, -2.68)  ( -3.03, 2.12)  ( -1.57, 0.16)  ( -1.51, 0.84)  

     ( 3.04, -3.01)  ( 4.30, 3.82)  ( 5.17, -0.59)  ( 5.45, 0.17)  ==1172046== 

==1172046== HEAP SUMMARY:

==1172046==   in use at exit: 11,803 bytes in 31 blocks

==1172046==  total heap usage: 99 allocs, 68 frees, 4,410,855 bytes allocated

==1172046== 

==1172046== LEAK SUMMARY:

==1172046==  definitely lost: 0 bytes in 0 blocks

==1172046==  indirectly lost: 0 bytes in 0 blocks

==1172046==   possibly lost: 0 bytes in 0 blocks

==1172046==  still reachable: 11,803 bytes in 31 blocks

==1172046==     suppressed: 0 bytes in 0 blocks

==1172046== Reachable blocks (those to which a pointer was found) are not shown.

==1172046== To see them, rerun with: --leak-check=full --show-leak-kinds=all

==1172046== 

==1172046== For lists of detected and suppressed errors, rerun with: -s

==1172046== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)



0 Kudos
Gennady_F_Intel
Moderator
99 Views

this thread is closing.


0 Kudos
Reply