简体   繁体   English

使用Intel C ++编译器的Armadillo错误

[英]Error in Armadillo with intel C++ compiler

I have been using Armadillo 4.2 version (from linux mint package manager) for quite a some time. 我已经使用Armadillo 4.2版本(来自Linux Mint Package Manager)已有一段时间了。 That version had no problem when compiled with icc, and codes compiled with icc ran very fast (about 10%-15% fast compared to g++). 使用icc编译时,该版本没有问题,并且使用icc编译的代码运行速度非常快(与g ++相比,大约快10%-15%)。

Recently I have upgraded Armadillo to recent 6.1 version (from the official website). 最近,我已将Armadillo升级到最新的6.1版本(来自官方网站)。 But in this case, all the codes compiled correctly with icc, but gave runtime error. 但是在这种情况下,所有代码都可以使用icc正确编译,但却给了运行时错误。

error: eig_sym(): failed to converge

terminate called after throwing an instance of 'std::runtime_error'
what():  eig_sym(): failed to converge
Aborted

Codes compiled correctly with g++ ran perfectly. 用g ++正确编译的代码可以完美运行。 I have also tried previous 5.6 version, but the same problem. 我也尝试过以前的5.6版本,但是同样的问题。 Any solutions?? 任何解决方案? I had to revert back to old 4.2 version to get that extra speed from icc... 我不得不恢复到旧的4.2版本才能从icc获得额外的速度...

The Intel C++ compiler is known to contain of bugs when dealing with heavily templated libraries like Armadillo (see for example here and here ). 众所周知,在处理大量模板化的库(例如Armadillo)时,Intel C ++编译器包含错误(请参见此处此处的示例)。

You can increase the performance of gcc compiled code by enabling auto-vectorization (using -O3 ) and using the native machine instruction set (using -march=native ). 通过启用自动向量化(使用-O3 )和使用本机指令集(使用-march=native ),可以提高gcc编译代码的性能。 For example: 例如:

g++ code.cpp -o code -O3 -march=native -larmadillo

Also make sure that the matrix you're passing to eig_sym() is actually symmetric. 还要确保传递给eig_sym()的矩阵实际上是对称的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM