2

我在 Visual Studio 2013 中使用 Boost MultiArrays。我使用 Visual STudio 的本机 x64 C++ 编译器编译了 Boost。我收到很多“info C5002”类型的警告。在警告旁边,我还获得了警告的原因代码。这是我的代码和我收到的一小部分警告。

#include <iostream>
#include <math.h>
#include <fstream>
#include "boost/multi_array.hpp"

using namespace std;

typedef boost::multi_array<float, 2> Grid;
int main()
{
    Grid myGrid;
    myGrid.resize(boost::extents[100][100]);
    return 0;
}

示例警告:

1> --- 分析函数:bool __cdecl std::_Equal<__int64 const * __ptr64,__int64 const * __ptr64>(__int64 const * __ptr64,__int64 const * __ptr64,__int64 const * __ptr64) 1> c:\program files (x86 )\microsoft visual studio 12.0\vc\include\xutility(2736) : info C5002: loop not vectorized due to reason '500'

对于我简单的 10 行代码,我确实收到了 100 条相同的警告。事实上,我得到 C5002 信息,即使除了 #include "boost/multi_array.hpp" 之外没有其他代码

我担心的是由于矢量化失败而导致的效率损失。我已经对我的多阵列进行了基准测试,实际上它们的运行速度比本机阵列慢得多,即使在发布模式下也是如此。请看这里:Boost MultiArrays 性能很差

我想知道是否有办法让编译器正确矢量化,这样我在使用多数组时就不会损失运行时效率。

4

0 回答 0