为什么必须在循环变量中并行签名? [英] Why must loop variables be signed in a parallel for?
问题描述
我只是从在线教程和资源学习OpenMP。我想使用 parallel for
循环来平方一个矩阵(乘以它自己)。在 IBM编译器文档,我发现迭代变量必须是签名的
整数的要求。这在GCC实现中也是如此吗?是否在OpenMP标准中指定?
I'm just learning OpenMP from online tutorials and resources. I want to square a matrix (multiply it with itself) using a parallel for
loop. In IBM compiler documentation, I found the requirement that "the iteration variable must be a signed
integer." Is this also true in the GCC implementation? Is it specified in the OpenMP standard? If so, is there a reason for this requirement?
(无关紧要,因为预期的尺寸远远小于 INT_MAX > code>,但它确实需要我一些cast。)
(It doesn't matter much as the expected dimensions are far smaller than INT_MAX
, but it does cost me some casts.)
推荐答案
根据OpenMP 3.0规范:http://www.openmp.org/mp-documents/spec30.pdf ,变量可以是签名或无符号整数类型,请参见2.5.1循环构造。问题是OpenMP实现是否符合最新规范。
According to OpenMP 3.0 specification: http://www.openmp.org/mp-documents/spec30.pdf, for variable may be of a signed or unsigned integer type, see 2.5.1 Loop Construct. The question is whether given OpenMP implementation matches this latest specification.
这篇关于为什么必须在循环变量中并行签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!