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

dgemm - Intel inspector: "uninitialized memory acces"

Guillaume_A_
New Contributor I
627 Views

Hi,

I launched an Memory Error Analysis with Intel Inspector on simple test of the dgemm function and i got this warning: "uninitialized memory access" located on the dgemm call.

Here is my test (really simple !) :

void dgemm_test()
{
  double *A,*B,*C;
  double alpha, beta;
  int m,i;

  m = 10;
  A = (double*)mkl_malloc((m*m)*sizeof(double),128);
  B = (double*)mkl_malloc((m*m)*sizeof(double),128);
  C = (double*)mkl_malloc((m*m)*sizeof(double),128);

  for(i=0; i<m*m; i++){
    A = (double)(rand() % (m*m)) / (double)(m*m);
    B = (double)(rand() % (m*m)) / (double)(m*m);
    C = 0.0;
  }

  alpha = 1.0;
  beta = 0.0;
  cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, m, m, alpha, A, m, B, m, beta, C, m);

  mkl_free(A);
  mkl_free(B);
  mkl_free(C);
}

Each buffer seems to be initialized... Do I have to be worried about this warning ? Is it an expected behavior ?

My configuration: Intel Inspector XE 2013.  MKL: 11.1.2 (32bit mode). CPU: Xeon E5-1620. OS: W7 64bit (SP1).

Thanks in advance for your help !

0 Kudos
1 Solution
Zhang_Z_Intel
Employee
627 Views

This is a known problem of Intel Inspector. It reports false alarms for some MKL routines.

View solution in original post

0 Kudos
3 Replies
mecej4
Honored Contributor III
627 Views

The problem with partial reports such as yours is that they cannot be verified.

Using the current versions of Intel C (15.0) and MKL (11.2) with the older Inspector 2013, I added a few lines of code to make a complete example as shown below. Note that I have suppressed initialization of C, which should be OK when alpha = 0. I see no reports of uninitialized variables with Inspector XE. However, when I change the value of alpha to a nonzero value, I do get detection of uninitialized variables. Reactivation of the initialization of C made the error go away. All these findings agree with what one expects.

#include <stdio.h>
#include <mkl.h>

void dgemm_test()
{
  double *A,*B,*C;
  double alpha, beta;
  int m,i;

  m = 10;
  A = (double*)mkl_malloc((m*m)*sizeof(double),128);
  B = (double*)mkl_malloc((m*m)*sizeof(double),128);
  C = (double*)mkl_malloc((m*m)*sizeof(double),128);

  for(i=0; i<m*m; i++){
    A = (double)(rand() % (m*m)) / (double)(m*m);
    B = (double)(rand() % (m*m)) / (double)(m*m);
//    C = 0.0;
  } 

  alpha = 0.0;
  beta  = 1.0;
  cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, m, m, alpha, A, m, B, m, beta, C, m);

  mkl_free(A);
  mkl_free(B);
  mkl_free(C);
}

main(){
dgemm_test();
}

 

0 Kudos
Zhang_Z_Intel
Employee
628 Views

This is a known problem of Intel Inspector. It reports false alarms for some MKL routines.

0 Kudos
Gennady_F_Intel
Moderator
627 Views

btw, the latest version of Inspector ( Intel(R) Inspector XE 2015) doesn't report such sort of problem. 

0 Kudos
Reply