dcg_check problem between versions MKL 2011 and 2013

dcg_check problem between versions MKL 2011 and 2013

Hi,

I have a problem I don't get to solve. My problem refers to dcg_check function.

In the version of MKL, 2011, that I have installed at home the function works well. But at work I'm using a newer version of MKL, 2013, and this method is not working as desired. My code is written in C. Just to get familiar with the call:

dcg_check(&n,solution,rhs,&rci_request,ipar,dpar,tmp); 
 

The error it produces say:

Intel MKL RCI CG WARNING: Parameter IPAR(3) must be equal to 1 before the first call to DCG routine.
 

The parameters loaded in ipar are the following:

ipar[4]=1000; 
ipar[8]=1; 
ipar[9]=0;
ipar[10]=1;

 

By default ipar[3] is set to 1 and I've also set this value to 1, just in case, in other trials before the call to dog_check. Therefore, I don't understand what is wrong in my code. Even more, when in MKL 2011 it works but it doesn't for MKL 2013.

 

Have you faced this problem before? Do you know which can be the mistake and the solution?

 

Thanks!

Victor

10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Note that in Fortran array indices start at 1 by default. Therefore, the error message regarding the value of IPAR(3) should be viewed as a report about an error in the value of ipar[2] set in your caller.

I know the issue about the indexes but it doesn't solve anything, I've even tried value 1 in all 4 first positions of ipar, and I still have the same problem.

For me its seems a problem between the versions of MKL not in the array. But thanks for the answer.

Did you call dcg_init before calling dcg_check, or do you set all the ipar[] and [par] values yourself? It is probably best for you to post the code that gives you different results between different MKL versions.

I tried the cg_no_precon_c.c example distributed with MKL with two version of MKL: 10.3.9 and 11.1.4, and received identical results. This example calls dcg_init first, modifies some entries in the ipar[] array, and then calls dcg_check.

Please post a complete example code, if possible.

Hi,

Here is the code:

double *a,*rhs,*solution,*tmp;

MKL_INT *ia,*ja;

ia=calloc(NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C+1,sizeof(MKL_INT));
ja=calloc(numero_no_ceros,sizeof(MKL_INT));
a=calloc(numero_no_ceros,sizeof(double));
rhs=calloc(NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C,sizeof(double));
solution=calloc(NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C,sizeof(double));
tmp=calloc(4*NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C,sizeof(double));

int k;
ia[0] = 1;
int counterValues = 0;
for (i=0;i<NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C-1;i++)
{     
      k=0;
      for (j=0;&Masas_3D[i][j] < Masas_3D[i+1];j++){ 
             k = k +1;
      }
      ia[i+1] = ia[i] + k; 
} 

ja[counterValues] = NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C; 
a[counterValues] = Masas_3D[i][0]; 

ia[NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C] = 
ia[NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C-1] + 1; 

MKL_INT n=NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C, rci_request, itercount, ipar[128], 

ione=1;

double euclidean_norm, dpar[128], eone=-1.E0;

char tr='u';

Match_Vectors(solution,x0,NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C,NOT_CONSTANT); 

Match_Vectors(rhs,b,NUMBER_OF_LEVELS_C*NUMBER_OF_NODES_C,NOT_CONSTANT); 

/*Init solution*/

dcg_init(&n,solution,rhs,&rci_request,ipar,dpar,tmp);

if (rci_request!=0) {
       printf("mkl init error\n");
       return;
}

ipar[2]=1;
ipar[4]=1000; 
ipar[8]=1; 
ipar[9]=0;
ipar[10]=1; 
dpar[0]=1.E-9;

/*Parameters consistancy check*/

dcg_check(&n,solution,rhs,&rci_request,ipar,dpar,tmp); 

if (rci_request!=0) {
       printf("mkl consistancy check error\n");
       return;
}

 

The beginning part of the source code has been lost, apparently, or did you want to post only part of the program? I should like to view the variable declarations, since errors can sometimes be made in that part.

All the initialisations are there. All the constants are integers. There is no overflow. Small numbers also produce the error.

Hi Victor, 

What are the platform and what are the linked MKL library you linked in the project? 

I also tried  same parameter  in windows both ia32 and intel 64 lp64, seqential mkl library. with MKL 11.1 in Composer 2013 sp1.  

 

44
dcg_init(&n,solution,rhs,&rci_request,ipar,dpar,tmp);

45
 

46
if (rci_request!=0) {

47
       printf("mkl init error\n");

48
       return;

49
}

50
 

51
ipar[2]=1;

52
ipar[4]=1000;

53
ipar[8]=1;

54
ipar[9]=0;

55
ipar[10]=1;

56
dpar[0]=1.E-9;

57
 

58
/*Parameters consistancy check*/

59
 

60
dcg_check(&n,solution,rhs,&rci_request,ipar,dpar,tmp);

 

But I can't reproduce the error. Intel MKL RCI CG WARNING: Parameter IPAR(3) must be equal to 1 before the first call to DCG routine.  

Best Regards,

Ying

 

I have realised that a mistake I have is in my array. I'm testing this in two machines 32bits and 64bits. In the 64bits machine I have a Segmentation fault.

I think the problem is right here:

mkl_dcsrsymv(&tr, &n, a, ia, ja, tmp, &tmp[n]);

These are the compilation flags:

feq ($(CC),gcc)

  CFLAGS=-g -Wall -O2 -m64 -DMKL_ILP64 -D__DBG__

        -I /opt/intel/composer_xe_2013_sp1.2.144/mkl/include

  LDFLAGS=-lm -lpthread -lmkl_intel_thread -lmkl_intel_ilp64

           -lmkl_sequential -lmkl_core

           -L /opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64

  DEPFLAGS=-MM

endif

The previous error in this thread is solved including the flag -DMKL_ILP64.

Could you help me?

Thanks!

Hi Victor, 

Right, if you link mkl_intel_ilp64 library, then -DMKL_ILP64 need to be defined .

For your current issue: Segmentation fault,  could you please try the example code  provided by MKL and see if it can run first?  Then please attach your complete test code.

for example, I try the example, with ILP64 model, it just run fine.

>copy the /opt/intel/mkldirecotry/example/example_core.tgz  to your home folder and extract it.  

>cd /home/yhu5/mkl_issue/solverc

run the below command: 

$ make sointel64 interface=ilp64 threading=sequential function="cg_no_precon_c" compiler=gnu

----- Compiling gnu_ilp64_sequential_intel64_so ----- cg_no_precon_c
gcc -m64  -w -DMKL_ILP64 -I"/opt/intel/composer_xe_2013_sp1.2.144/mkl/include" \
        ./source/cg_no_precon_c.c  \
        -L"/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64" -lmkl_intel_ilp64 \
        -lmkl_sequential \
        -lmkl_core \
          -lpthread -lm -ldl -o _results/gnu_ilp64_sequential_intel64_so/cg_no_precon_c.out
----- Execution gnu_ilp64_sequential_intel64_so ----- cg_no_precon_c
export LD_LIBRARY_PATH="/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64":/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/mkl/../compiler/lib/intel64; \
        _results/gnu_ilp64_sequential_intel64_so/cg_no_precon_c.out > _results/gnu_ilp64_sequential_intel64_so/cg_no_precon_c.res

Run the binary: 

$ _results/gnu_ilp64_sequential_intel64_so/cg_no_precon_c.out
The system has been solved
The following solution obtained
 1.000   0.000   1.000   0.000
 1.000  -0.000   1.000   0.000
Expected solution is
 1.000   0.000   1.000   0.000
 1.000   0.000   1.000   0.000
Number of iterations: 8
This example has successfully PASSED through all steps of computation!

Best Regards,

Ying

 

Leave a Comment

Please sign in to add a comment. Not a member? Join today