Visual Studio C++ 2015 and openMP

Visual Studio C++ 2015 and openMP

本文关键字:and openMP 2015 C++ Studio Visual      更新时间:2023-10-16

我想知道使用/OpenMP的VC 编译器的行为。我正在使用Cmakefilelist随附的第三方库(OpenMVG)。因此,我生成了Visual Studio解决方案来编译它。Cmake识别编译器的开放能力,并在VS撤离中汇编的编译良好。但是,当涉及执行时,我在每次运行程序中都会获得不同的结果。而且,如果我同时运行了两个程序实例,则结果甚至更糟。因此,我在源代码中看起来有些看,发现OpenMP与List和Map Iterator

一起使用。
#pragma omp parallel
for (Views::const_iterator iter = sfm_data.GetViews().begin(); iter != sfm_data.GetViews().end() && bContinue; ++iter)
{
  pragma omp single nowait
  { 
    ... process ... 
  }
}

我在网络上搜索,看来Visual Studio仅支持OpenMP 2.0。那么它支持列表迭代器吗?这是问题吗?OpenMP 2.0如何在列表迭代器中表现?

事先感谢任何答案

代码无法做您可能认为的。它创建了一组线程,每个线程执行相同的循环。

请注意,Visual Studio中的OpenMP并不真正支持C ,它将其视为C方言。特别是,/openmp不支持迭代器,因为这仅是C 。它仅支持(某些)C循环。

还要注意,OpenMP是旧标准,甚至比C 98。由于C 11,C 具有本机螺纹功能。