Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
10 Views

Preconditioner dcsrilu0 has returned the ERROR code -106

Jump to solution

hi, all, Please give me some suggestions about error: Preconditioner dcsrilu0 has returned the ERROR code -106.

I tried to use ilu + gmres to solve Ax=b.

Here, A is like

2 -1

  -1 2 -1

      -1  2 -1

and so on. I have attached code. Thanks.

 

0 Kudos

Accepted Solutions
Highlighted
Employee
10 Views

Attach the LinearSolver.c file.

Regards,

Ying

View solution in original post

0 Kudos
4 Replies
Highlighted
Employee
10 Views

Hi Maggie

ierr=-106 Indicates that the routine was interrupted because the
column indices jaare not in the ascending order..

As the dcsrilu0
 routine supports only one-based indexing of the array parameters, regardless of whether the
Fortran or C interface is used. 

You may need to comment out the code 

    //for(i=0; i<*N; i++) --ia;
     //   for(i=0; i<*NNZ; i++) --ja;

Best Regards,

Ying 

0 Kudos
Highlighted
Employee
10 Views

Hi Maggie, 

The requirement of "1-based index" for the function is  to  the content (Value) of array ia and ja,  not on array ia and ja 's index.

The array  ia and ja from Fortran and you are right that their index are from 1,  but it is not problem because fortran is passing the reference ( address) of ia and ja etc to C function. In the c code, their index are  from 0 naturally,  and the content in them are  1-based index.   you don't need change them.

    //for(i=0; i<*N; i++) --ia;
     //   for(i=0; i<*NNZ; i++) --ja;

And you can print the ia[0] and ja[0] to see the result.

 for(i=0; i<=5; i++) {printf("%d \t ", ia);}; printf("\n");

 for(i=0; i<=5; i++) {printf("%d\t", ja);}; printf("\n");

There are some code errors in your code.

and the array ipar and dpar should be 128 . not N. 

and the  bilu0 = (double *)calloc(*NNZ, sizeof(double)) , not NN etc.

remove some correct conditions which is in original sample code, you don't need when solve the Ax=b.. 

I attach the modifed code and run result for your reference. 

Best Regards,

Ying 

 

[yhu5@prc-mic01 mklex]$ make
ifort -check bounds -g -traceback -i8 -openmp -w -fast -DMKL_ILP64 -m64 -I/opt/intel/mkl/include/intel64/ilp64 -I/opt/intel/mkl/include  -c hypretest.f
icc -g -traceback -i8 -openmp -w -fast -DMKL_ILP64 -m64 -I/opt/intel/mkl/include/intel64/ilp64 -I/opt/intel/mkl/include  -c LinearSolver.c
ifort -check bounds -g -traceback hypretest.o LinearSolver.o -L/opt/intel/mkl/lib/intel64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_blas95_ilp64 -lmkl_lapack95_ilp64 -liomp5 -lmkl_core  -lm -lpthread -o ds
[yhu5@prc-mic01 mklex]$ ./ds
 number of rows =                     10
 number of nonzeros =                     28
sizetmpi= 306, sizeof(ia)= 8
N=10, NNZ= 28
LinearSolver: Line 48
dfgmres_init
dfgmres_end
ilu begin
ilu end
dfgmres check begin
dfgmres check end
Some info about the current run of RCI FGMRES method:

As ipar[7]=0, the automatic test for the maximal number of iterations will be
skipped
+++
As ipar[8]=0, the automatic residual test will be skipped
+++
As ipar[9]=1 the user-defined stopping test will be requested via
RCI_request=2
+++
As ipar[10]=1, the Preconditioned FGMRES iterations will be performed, thus,
the preconditioner action will be requested via RCI_request=3
+++
As ipar[11]=0, the automatic test for the norm of the next generated vector is
not equal to zero up to rounding and computational errors will be skipped,
thus, the user-defined test will be requested via RCI_request=4
+++

dfgmres begin to solve
dfgmres end of solve
dfgmres end of solve
dfgmres end of solve
dfgmres end of solve
dfgmres end of solve
dfgmres end of solve
The system has been solved

Number of iterations: 1

 b(                     1 )=   1.00000000000000
 b(                     2 )=   1.00000000000000
 b(                     3 )=   1.00000000000000
 b(                     4 )=   1.00000000000000
 b(                     5 )=   1.00000000000000
 b(                     6 )=   1.00000000000000
 b(                     7 )=   1.00000000000000
 b(                     8 )=   1.00000000000000
 b(                     9 )=   1.00000000000000
 b(                    10 )=   1.00000000000000
[yhu5@prc-mic01 mklex]$

Attachments: 

0 Kudos
Highlighted
Employee
11 Views

Attach the LinearSolver.c file.

Regards,

Ying

View solution in original post

0 Kudos
Highlighted
Beginner
10 Views

Ying, Thank you so much for the help. It definitely resolved my concern. 

0 Kudos