VS2010 开启 openMP

VS2010 开启 openMP  

来自杨天虎的日志: http://09105106.blog.163.com/blog/static/2483578201282995234144/

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages(属性页) dialog box. For details, see How to: Open Project Property Pages.

  2. Expand the Configuration Properties(配置属性) node.

  3. Expand the C/C++ node.

  4. Select the Language(语言) property page.

  5. Modify the OpenMP Support(OpenMP支持) property.

 

来自: http://msdn.microsoft.com/en-us/library/fw509c3b.aspx

 

简单实例:

#include "stdafx.h" #include "omp.h"

int _tmain(int argc, _TCHAR* argv[]) {     #pragma omp parallel num_threads(4)     {         _tprintf(_T("Hello, World! ThreadId=%d\n"),omp_get_thread_num());     }

return 0; }

运行结果:
VS2010 开启 openMP_第1张图片

你可能感兴趣的:(VS2010 开启 openMP)