c++ - Cholesky with ScaLAPACK -


i trying cholesky decomposition via pdpotrf() of mkl-intel's library, uses scalapack. reading whole matrix in master node , distribute in example. works fine when dimension of spd matrix even. however, when it's odd, pdpotrf() thinks matrix not positive definite.

could because submatrices not spd? working matrix: enter image description here

and submatrices (with 4 processes , blocks of size 2x2):

a_loc on node 0   4   1   2   1 0.5   0   2   0  16  nrows = 3, ncols = 2 a_loc on node 1   2 0.5   0   0   0   0  nrows = 2, ncols = 3 a_loc on node 2   2   0   0 0.5   0   0  nrows = 2, ncols = 2 a_loc on node 3   3   0   0 0.625 

here, every submatrix not spd, however, overall matrix spd (have checked running 1 process). should do? or there nothing can , pdpotrf() not work matrices of odd size?


here how call routine:

int izero = 0; int desca[9]; // n, m dimensions of matrix. lda = n // nb, mb dimensions of block descinit_(desca, &n, &m, &nb, &mb, &izero, &izero, &ctxt, &lda, &info); ... pdpotrf((char*)"l", &ord, a_loc, &ia, &ja, desca, &info); 

i tried this:

// nrows/ncols number of rows/columns submatrix has descinit_(desca, &n, &m, &nrows, &ncols, &izero, &izero, &ctxt, &lda, &info); 

but error:

{ 0, 0}: on entry { 0, 1}: on entry pdpotr{ 1, 0}: on entry pdpotrf parameter number 605 had illegal value { 1, 1}: on entry pdpotrf parameter number 605 had illegal value f parameter number 605 had illegal value

pdpotrf parameter number 605 had illegal value info < 0: if i-th argument array , j-entry had illegal value, info = -(i*100+j), if i-th argument scalar , had illegal value, info = -i. info = -605

from answer, can see arguments of function mean.


the code based on question. output:

gsamaras@pythagoras:~/konstantis/check_examples$ ../../mpich-install/bin/mpic++ -o test minor.cpp -i../../intel/mkl/include ../../intel/mkl/lib/intel64/libmkl_scalapack_lp64.a       -wl,--start-group       ../../intel/mkl/lib/intel64/libmkl_intel_lp64.a ../../intel/mkl/lib/intel64/libmkl_core.a  ../../intel/mkl/lib/intel64/libmkl_sequential.a    -wl,--end-group ../../intel/mkl/lib/intel64/libmkl_blacs_intelmpi_lp64.a -lpthread       -lm     -ldl gsamaras@pythagoras:~/konstantis/check_examples$ mpiexec -n 4 ./test processes grid pattern: 0 1 2 3 nrows = 3, ncols = 3 a_loc on node 0   4   1   2   1 0.5   0   2   0  16  nrows = 3, ncols = 2 a_loc on node 1   2 0.5   0   0   0   0  nrows = 2, ncols = 3 a_loc on node 2   2   0   0 0.5   0   0  nrows = 2, ncols = 2 a_loc on node 3   3   0   0 0.625  description init sucesss! matrix not positive definte matrix result:   2   1   2 0.5   2 0.5 0.5   0   0   0   1   0   1   0 -0.25 0.25  -1 -0.5 0.625   0   1  -1  -2 -0.5  14 

the issue may come :

mpi_bcast(&lda, 1, mpi_int, 0, mpi_comm_world); 

before line, lda different on each process if dimension of matrix odd. 2 processes handle 2 rows , 2 processes handle 3 rows. after mpi_bcast(), lda same everywhere (3).

the problem argument lda of subroutine descinit must leading dimension of local array, either 2 or 3.

by commenting mpi_bcast(), got:

description init sucesss! success matrix result: 2   1   2 0.5   2  0.5 0.5   0   0   0  1  -1   1   0   0  0.25 -0.25 -0.5 0.5   0  1  -1  -2  -3   1  

at last, explain program works dimensions , fails odd dimensions !


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -