Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

Unitialized issue in cblas_dsyrk

$
0
0

I have created a very small test program that illustrates an an issue in syrk. In fact when I run valgrind on my program I get.

==44033==

==44033== Conditional jump or move depends on uninitialised value(s)
==44033==    at 0x401CFD: main (testsyrk.c:40)
==44033==
Check 990
==44033==
==44033== HEAP SUMMARY:
==44033==     in use at exit: 39,184 bytes in 4 blocks
==44033==   total heap usage: 4 allocs, 0 frees, 39,184 bytes allocated

My program is so simple and I will claim the uninitialised value comes from cblas_dsyrk.

The follow instructions reproduce the issue:

icc -g -o testsyrk testsyrk.c -I$MKLROOT/include  -Wl,--start-group $MKLROOT/lib/intel64/libmkl_intel_lp64.a $MKLROOT/lib/intel64/libmkl_core.a $MKLROOT/lib/intel64/libmkl_sequential.a -Wl,--end-group -lpthread -lm

 

valgrind ./testsyrk 

I use the latest Intel 15.0.1.

Here is my program

#include <stdio.h>
#include <stdlib.h>

#include "mkl_cblas.h"
#include "mkl_lapack.h"

int main()
{
  double *source,*target;
  int    i,j,
         z=0,
         d=44,w=14;

  source = calloc(d*w,sizeof(double));
  target = calloc(d*d,sizeof(double));

  for(j=0; j<w; ++j)
    for(i=0; i<d; ++i)
      source[d*j+i] = 1.0;

  for(j=0; j<d; ++j)
    for(i=0; i<=j; ++i)
      if ( target[j*d+i]>0.0 )
        z += 1;

  cblas_dsyrk(CblasColMajor,
              CblasUpper,
              CblasNoTrans,
              d,w,
              1.0,source,d,
              0.0,target,d);

  for(j=0; j<d; ++j)
    for(i=0; i<=j; ++i)
    {
      #if 0
      fprintf(stderr,"%d %d\n",i,j);
      #endif

      if ( target[j*d+i]>0.0 )
        z += 1;
    }

  printf("Check %d\n",z);

  return ( 0 );
}

 

 

 


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>