【发布时间】:2015-07-05 14:34:42
【问题描述】:
我正在尝试通过使用 ScaLAPACK 的 MKL-Intel 库的 pdpotrf() 进行 Cholesky 分解。我正在读取主节点中的整个矩阵,然后像 example 那样分发它。当 SPD 矩阵的维数是偶数时,一切正常。但是,当它很奇怪时,pdpotrf() 认为矩阵不是正定矩阵。
可能是因为子矩阵不是 SPD 吗?我正在使用这个矩阵:
子矩阵是(有 4 个进程和大小为 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
这里,每个子矩阵都不是 SPD,但是,整个矩阵都是 SPD(已检查运行 1 个进程)。我该怎么办?还是我无能为力,pdpotrf() 不适用于奇数大小的矩阵?
这是我如何调用例程的:
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);
我也试过这个:
// nrows/ncols is the number of rows/columns a submatrix has
descinit_(descA, &N, &M, &nrows, &ncols, &iZERO, &iZERO, &ctxt, &lda, &info);
但我得到一个错误:
{ 0, 0}: 进入 { 0, 1}: 进入 PDPOTR{ 1, 0}:在进入 PDPOTRF 参数号 605 时具有非法值 { 1, 1}:在进入 PDPOTRF 参数号 605 时存在非法 值 F 参数号 605 具有非法值
PDPOTRF 参数编号 605 具有非法值 info
从我的answer,你可以看到函数的参数是什么意思。
代码基于此question。输出:
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 is not positive definte
Matrix A 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
【问题讨论】:
-
你可以试试 LAPACK 版本 (dpotrf)...
-
这不是分发@Jeff。我也用
dpotrf()进行了检查,它可以工作。但是,我只对分布式解决方案感兴趣。 -
我知道这一点。关键是获得调试洞察力。看来你已经做到了。
-
您也可以尝试 Elemental,它具有更友好的 API,对 Cholesky 的性能相同或更好,并且不仅支持密集矩阵。
-
哦好的@Jeff,是的,我有,应该提到,对不起,会编辑。我认识Elemental,项目负责人Jack Poulson 非常友好和善良。但是,由于各种原因,我不得不使用 ScaLAPACK。所以,现在我必须看看
pdpotrf()发生了什么。你认为它不能处理奇数维度吗?
标签: c++ distributed-computing blas intel-mkl scalapack