Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

Simple task from example failing to execute

$
0
0

Hi all,

I' ve got a simple example from http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mklman/index.htm

which works fine.

I wrote the pretty similar code

#include <stdio.h>
#include "mkl.h"
#include "errcheck.inc"

#define NPART 10
#define NDIM 2
#define STREAMFILENAME "task.stream"

int main(){

  VSLStreamStatePtr stream;
  FILE* streamfile;
  int errcode=0;
  double *r=malloc(NPART*NDIM*sizeof(double));
  double M[]={1e0,0e0},S[]={1e0,1e0};

  VSLSSTaskPtr task;
  double *m=malloc(NDIM*sizeof(double));
  MKL_INT rstorage=VSL_SS_MATRIX_STORAGE_ROWS;
  int ipart=0,idata=0,idim=0;
  MKL_INT npart=NPART,ndim=NDIM,xstorage=VSL_SS_MATRIX_STORAGE_COLS;

  streamfile=fopen(STREAMFILENAME,"r");
  if(streamfile){
    fclose(streamfile);
    errcode=vslLoadStreamF(&stream,STREAMFILENAME);
  }else{
    errcode=vslNewStream(&stream,VSL_BRNG_MCG31,7777777);
  }

  errcode=vdRngGaussianMV(VSL_RNG_METHOD_GAUSSIANMV_BOXMULLER2,stream,
    NPART,(double*)r,NDIM,VSL_MATRIX_STORAGE_DIAGONAL,M,(double*)S);

  errcode=vsldSSNewTask(&task,&npart,&ndim,&xstorage,r,0,0);

  errcode=vsldSSEditTask(task,VSL_SS_ED_MEAN,m);

  errcode=vsldSSCompute(task,VSL_SS_MEAN,VSL_SS_METHOD_FAST);
  errcode=vslSSDeleteTask(&task);
  CheckVslError(errcode);

  for(idim=0;idim<NDIM;idim++)printf("%20.16e ",m[idim]);
  printf("\n");  free(r);
  free(m);
  errcode=vslSaveStreamF(stream,STREAMFILENAME);

  return 0;
}

this wont work at all. I can compile and run, but a fatal error occurs

in between vsldSSCompute and result printing.

Where am I doing the error? Can someone help me?

Thanks!

 


Viewing all articles
Browse latest Browse all 2652

Trending Articles