我尝试了在两个平台上使用特征向量函数的简单示例:Intel和s390x。
参考:http://eigen.tuxfamily.org/index.php?title=FAQ#Vectorization
在Intel上,代码可以使用矢量化进行编译(默认为-msse2)并生成输出。
在s390x上,编译失败,并显示错误:__builtin_s390_vfi was not declared in this scope
。
错误:
In file included from /usr/include/eigen3/Eigen/Core:385:0,
from /usr/include/eigen3/Eigen/Dense:1,
from mypgm.cpp:2:
/usr/include/eigen3/Eigen/src/Core/arch/ZVector/PacketMath.h: In function âPacket Eigen::internal::pmin(const Packet&, const Packet&) [with Packet = __vector(2) double]â:
/usr/include/eigen3/Eigen/src/Core/arch/ZVector/PacketMath.h:567:115: error: â__builtin_s390_vec_minâ matching variant requires z14 or higher
template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_min(a, b); }
^
In file included from /usr/include/eigen3/Eigen/Core:220:0,
from /usr/include/eigen3/Eigen/Dense:1,
from mypgm.cpp:2:
/usr/include/eigen3/Eigen/src/Core/arch/ZVector/PacketMath.h: In function âPacket Eigen::internal::pround(const Packet&) [with Packet = Eigen::internal::Packet4f]â:
/usr/include/eigen3/Eigen/src/Core/arch/ZVector/PacketMath.h:629:16: error: â__builtin_s390_vfiâ was not declared in this scope
res.v4f[0] = vec_round(a.v4f[0]);
在z14 vm上使用矢量化构建TensorFlow时发现了相同的问题。
我在z14 s390x vm上使用了-march = z14 -mzvector标志。
Eigen是否支持s390x的矢量化?