• <legend id='fPyF1'><style id='fPyF1'><dir id='fPyF1'><q id='fPyF1'></q></dir></style></legend>

    1. <small id='fPyF1'></small><noframes id='fPyF1'>

        <bdo id='fPyF1'></bdo><ul id='fPyF1'></ul>

      <tfoot id='fPyF1'></tfoot>
      1. <i id='fPyF1'><tr id='fPyF1'><dt id='fPyF1'><q id='fPyF1'><span id='fPyF1'><b id='fPyF1'><form id='fPyF1'><ins id='fPyF1'></ins><ul id='fPyF1'></ul><sub id='fPyF1'></sub></form><legend id='fPyF1'></legend><bdo id='fPyF1'><pre id='fPyF1'><center id='fPyF1'></center></pre></bdo></b><th id='fPyF1'></th></span></q></dt></tr></i><div id='fPyF1'><tfoot id='fPyF1'></tfoot><dl id='fPyF1'><fieldset id='fPyF1'></fieldset></dl></div>

        错误 C3017:OpenMP 'for' 语句中的终止测试形式不正确

        error C3017: termination test in OpenMP #39;for#39; statement has improper form(错误 C3017:OpenMP for 语句中的终止测试形式不正确)
        <tfoot id='XDAFq'></tfoot>
          • <small id='XDAFq'></small><noframes id='XDAFq'>

            <legend id='XDAFq'><style id='XDAFq'><dir id='XDAFq'><q id='XDAFq'></q></dir></style></legend>

                <bdo id='XDAFq'></bdo><ul id='XDAFq'></ul>
                    <tbody id='XDAFq'></tbody>
                  <i id='XDAFq'><tr id='XDAFq'><dt id='XDAFq'><q id='XDAFq'><span id='XDAFq'><b id='XDAFq'><form id='XDAFq'><ins id='XDAFq'></ins><ul id='XDAFq'></ul><sub id='XDAFq'></sub></form><legend id='XDAFq'></legend><bdo id='XDAFq'><pre id='XDAFq'><center id='XDAFq'></center></pre></bdo></b><th id='XDAFq'></th></span></q></dt></tr></i><div id='XDAFq'><tfoot id='XDAFq'></tfoot><dl id='XDAFq'><fieldset id='XDAFq'></fieldset></dl></div>
                  本文介绍了错误 C3017:OpenMP 'for' 语句中的终止测试形式不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个定义了所有变量的 for 循环

                  I have a for loop that has all variables defined

                  #pragma omp parallel for
                  for(long long l = 1; l<=sqrtt; l++) ...
                  

                  当我在 Visual Studio 2012 中使用 /openmp 命令行选项编译它时,它给了我

                  When I compile this with the /openmp command line option in Visual Studio 2012, it gives me

                  error C3017: termination test in OpenMP 'for' statement has improper form
                  

                  我不知道为什么'for'语句的形式不正确.

                  OpenMP 的正确语句是什么?如何将其应用于我的 for 循环?

                  What is a proper for statement to OpenMP? How do I apply it to my for loop?

                  推荐答案

                  OpenMP 3.1 标准为 for-loop 结构规定了一种非常严格的形式(参见第 39 页):

                  The OpenMP 3.1 standard prescribes a very strict form for the for-loop construct (see pag.39):

                  for (init-expr; test-expr; incr-expr) structured-block
                  

                  特别是,test-expr 必须类似于以下之一:

                  In particular, test-expr must look like one of the following:

                  var relational-op b
                  b relational-op var
                  

                  其中 relational-op<,<=,>,>= 之一,bloop invariant 类型与 var 类型兼容的表达式.

                  where relational-op is one of <,<=,>,>= and b is a loop invariant expressions of a type compatible with the type of var.

                  除此之外,您必须确保:

                  Other than that you must ensure that:

                  关联的循环的循环控制表达式的值对于循环中的所有线程,循环结构必须相同团队.

                  The values of the loop control expressions of the loops associated with the loop construct must be the same for all the threads in the team.

                  所以,回到你的情况,我会检查 sqrtt 是否是循环不变的,并且所有线程都具有相同的值.

                  So, coming back to your case, I would check sqrtt to be a loop invariant and to have the same value for all threads.

                  long long 在 C++11 之前的 C++ 中不是标准的,参见例如 这个问题 关于 SO.

                  long long isn't standard in C++ prior to C++11, see for instance this question on SO.

                  这篇关于错误 C3017:OpenMP 'for' 语句中的终止测试形式不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Constructor initialization Vs assignment(构造函数初始化 Vs 赋值)
                  Is a `=default` move constructor equivalent to a member-wise move constructor?(`=default` 移动构造函数是否等同于成员移动构造函数?)
                  Has the new C++11 member initialization feature at declaration made initialization lists obsolete?(声明时新的 C++11 成员初始化功能是否使初始化列表过时了?)
                  Order of constructor call in virtual inheritance(虚继承中构造函数调用的顺序)
                  How to use sfinae for selecting constructors?(如何使用 sfinae 选择构造函数?)
                  Initializing a union with a non-trivial constructor(使用非平凡的构造函数初始化联合)
                  • <bdo id='XOzOL'></bdo><ul id='XOzOL'></ul>
                    <legend id='XOzOL'><style id='XOzOL'><dir id='XOzOL'><q id='XOzOL'></q></dir></style></legend>
                    <i id='XOzOL'><tr id='XOzOL'><dt id='XOzOL'><q id='XOzOL'><span id='XOzOL'><b id='XOzOL'><form id='XOzOL'><ins id='XOzOL'></ins><ul id='XOzOL'></ul><sub id='XOzOL'></sub></form><legend id='XOzOL'></legend><bdo id='XOzOL'><pre id='XOzOL'><center id='XOzOL'></center></pre></bdo></b><th id='XOzOL'></th></span></q></dt></tr></i><div id='XOzOL'><tfoot id='XOzOL'></tfoot><dl id='XOzOL'><fieldset id='XOzOL'></fieldset></dl></div>

                    1. <tfoot id='XOzOL'></tfoot>

                        • <small id='XOzOL'></small><noframes id='XOzOL'>

                            <tbody id='XOzOL'></tbody>