Pls let me know why the code bellow shows invalid results(sum) when NR is greater than 1999.
#define NR 2000 // MEAN=1 but invalid SUM !
//#define NR 1999 // MEAN=1 and SUM==1999 of course
#define DIM 4
void Test()
{
VSLSSTaskPtr task;
int errcode,dim = DIM, n=NR,x_storage=VSL_SS_MATRIX_STORAGE_COLS;
double x[NR*DIM],mean[DIM], sum[DIM],W[2];
W[0]=0; W[1]=0;
for(int j=0;j<DIM;++j) {mean
for(int i=0;i<NR*DIM;++i) x=1;
errcode = vsldSSNewTask( &task, &dim, &n, &x_storage, (double*)x, 0, 0 );
errcode = vsldSSEditTask(task,VSL_SS_ED_ACCUM_WEIGHT,W);
errcode = vsldSSEditTask(task,VSL_SS_ED_MEAN,mean);
errcode = vsldSSEditTask(task,VSL_SS_ED_SUM,sum);
errcode = vsldSSCompute( task, VSL_SS_MEAN | VSL_SS_SUM, VSL_SS_METHOD_FAST );
for(int i=0;i<dim;++i) printf("M[%d] %g S[%d] %g\n",i,mean,i, sum);
errcode = vslSSDeleteTask( &task );
}
The result when NR=2000 is:
M[0] 1 S[0] -2.65698e+303
M[1] 1 S[1] -2.65698e+303
M[2] 1 S[2] -2.65698e+303
M[3] 1 S[3] -2.65698e+303
I got this result under
Windows 8.1
Intel(R) Math Kernel Library Version 11.1.3 Product Build 20140416 for 32-bit applications
链接已复制
I tried your program (after changing "Test" to "main") with the 14.0.2.176 32-bit compiler and MKL 11.1.3 on Windows 8.1 X64 , and I could not reproduce the problem. Please state the compiler version number and specify the compiler options used.
Hi mecej4,
Thank you for your quick follow!
Ok, It may depend on some optimization done by the compiler used.
I am using MS Visual studio 2012 and the program is in some other tesiting stuffs.
I will extract it alone and make a new simple solution.
I will upload whole solution files if I succeed to reproduce the error.
MS Visual studio may have bug.
I got correct result in 'Release' mode,the error was in 'Debug' mode!!!
I should have tested it in both modes even for such a simple example ...
But this is not a MKL issue anyway... thank you.