首页 > 解决方案 > Chapel LinearAlgebra 在调用 eig(csrA, left = true, right = true); 时报告错误

问题描述

使用在线 IDE中的 进行原型设计,文档中关于如何使用模块的example2.chpl无法对复杂值的 CSR 稀疏矩阵-instance 进行操作。codeLinearAlgebraproc eig(…)csrMatrixA

代码:

use LinearAlgebra.Sparse, IO.FormattedIO;

config var N = 3;                                 // May use on the CLI-cmdline or here, below in the launcher's Arguments.add: --N=<aNumber>

var csrDOMAIN  = CSRDomain( N, N );               // Create an empty 3x3 CSR domain ---------> https://chapel-lang.org/docs/primers/sparse.html#primers-sparse
var csrMatrixA = CSRMatrix( csrDOMAIN, complex ); // Create a CSR matrix over this domain
                                                  // The above is equivalent to:               var matA: [csrDOMAIN] <dtype>;

csrDOMAIN += (1,1);                               // Add as an exemaple these indices to the sparse domain for all the nonzero data-cells
csrDOMAIN += (1,2);
csrDOMAIN += (2,2);
csrDOMAIN += (2,1);
csrDOMAIN += (3,3);

csrMatrixA.re =  1.23;                            // Set as an example all nonzero elements, all sparsely distributed over a domain indirectly described by csrDOMAIN, to a value of 1.23
csrMatrixA.im = -4.56;                            // Set as an example all nonzero elements, all sparsely distributed over a domain indirectly described by csrDOMAIN, to a value of-4.56i

writef( "CSR-Sparse Matrix A::[%i x %i] has values of:\n",
         N,
         N
         );

writeln( csrMatrixA );                            // A is now a 3x3 sparse matrix

/*/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CRASH-REPORT:

var (     eigenVALUEs,
     rightEigenVECTORs ) = eig( csrMatrixA, right = true ); // ------------------------------> https://chapel-lang.org/docs/modules/packages/LinearAlgebra.html#LinearAlgebra.eig

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TiO.RUN::
// .code.tio.chpl:22: error: unresolved call 'eig([CSDom(2,int(64),domain(2,int(64),false),true,false,false)] complex(128), left=1, right=1)'
// $CHPL_HOME/modules/packages/LinearAlgebra.chpl:1404: note: this candidate did not match: eig(A: [] ?t, param left = false, param right = false)
// $CHPL_HOME/modules/packages/LinearAlgebra.chpl:1404: note: because where clause evaluated to false
// $CHPL_HOME/modules/packages/LinearAlgebra.chpl:1618: note: candidates are: eig(A: [] ?t, param left = false, param right = false)
//

writeln( eigenVALUEs );
  */

编译器设置: 运行时参数:(与atm无关)--fast
--N=3

您能否提出建议
a)满足预期语法(调用签名)的正确方法是什么

b)您能否将修复的 MCVE 代码示例进一步扩展,以演示如何进行eig()-processing在一个非常稀疏、非对称的情况下以并行分布的方式实际运行。N x N用于N ~ 2E7(拥有实际数据)的CSR 域~ 5 [GB],不是因为 RAM 大小而分布,而是为了在多个区域设置更快的处理,以便有效地利用所有可用的 CPU 资源

c)什么是网络处理如果以托管的单一区域设置处理为基准,这种方法的加速?

追溯:

$CHPL_HOME/modules/packages/LinearAlgebra.chpl:1404: note:
this candidate did not match: eig(A: [] ?t, param left = false, param right = false)
$CHPL_HOME/modules/packages/LinearAlgebra.chpl:1404: note:
because where clause evaluated to false
$CHPL_HOME/modules/packages/LinearAlgebra.chpl:1618: note:
candidates are: eig(A: [] ?t, param left = false, param right = false)


最近的重新测试,在提交 Ben Albrecht 的[issue-14725]票后,确认两者(complex)(int) eltType -s 以类似的方式崩溃,但(real) CSRMatrix()-instance 引发 LAPACK-code 错误:如更新代码中所述

$CHPL_HOME/modules/packages/LAPACK.chpl:19775: error:
c_ptrTo unsupported array type

标签: chapel

解决方案


a)看起来这是线性代数库的一个未实现的功能。我在这里提出了一个问题:https ://github.com/chapel-lang/chapel/issues/14725

LinearAlgebrab) Chapel 1.20 在模块中还没有分布式特征求解器。如果您觉得它有价值,我鼓励您在 github 存储库上打开一个请求此功能的问题。

c) 见 (b)


推荐阅读