openmp - 并行使用 Eigen LeastSquaresConjugateGradient
问题描述
我正在尝试使用 Eigen 库的 LeastSquaresConjugateGradient 求解 Ax=b 形式的线性方程组,并且 A 是稀疏矩阵。
LeastSquaresConjugateGradient < SparseMatrix < double >> 求解器;
求解器.计算(一);
x = 求解器.solve(b);
原则上它工作得很好。但我想将它用于相当大的矩阵,因此并行运行它会很好。Eigen 文档仅提到将以下几行放在首位。
omp_set_num_threads(2);
setNbThreads(2);
此外,文档指出 LeastSquaresConjugateGradient 例程应该并行工作。
我还通过 export OMP_NUM_THREADS=2 设置了 bash 中的线程数
但是我仍然没有获得任何性能提升。我究竟做错了什么??
解决方案
推荐阅读
- r - 加宽数据框并插入缺失的列
- json - 10 次中有 1 次出现错误 json.decoder.JSONDecodeError: Expecting ','
- python - 列表中的 XGBoost 功能重要性
- angular - 如何将角度单元测试写入组件外部的函数
- python - 如何在 VSCode 中获取一般 pyd 文件和 confluent_kafka 的参数提示?
- node.js - Flutter + FCM:java.lang.IllegalArgumentException:不支持的值:Bundle[mParcelledData.dataSize=100]
- c# - 为什么我可以从计算机堆栈c#的末尾访问数据
- python - 为什么这个 django url 不在 Mac 上运行?
- r - 使用 openxlsx 包的工作表链接问题
- node.js - 无法从猫鼬模型中获得文档“查找”承诺