OpenMP G++ 错误:折叠的循环未完全嵌套
openmp g++ error: collapsed loops not perfectly nested
我尝试编译
#include <omp.h>
using namespace std;
vector< vector<int> > multiplyMatrixes(const vector< vector<int> > &a, const vector< vector<int> > &b, int aHeight, int aWidth, int bHeight, int bWidth) {
vector < vector<int> > c(aHeight, vector<int>(bWidth, 0));
#pragma omp parallel for collapse(2)
for(int row = 0; row < aHeight; row++) {
for(int col = 0; col < bWidth; col++) {
int value = 0;
for(int i = 0; i < aWidth; i++) {
value += a[row][i] * b[i][col];
}
c[row][col] = value;
cout<<"Tread #"<<omp_get_thread_num()<<"n";
}
std::cout<<'n';
}
return c;
}
int main() {}
使用"g++ -fopenmp hello.cpp -o hello"命令,gcc 版本是 4.7,但我得到以下 '您好.cpp:19:17:错误:折叠的循环未完全嵌套"什么意思?
谷歌搜索错误发现"循环必须完美嵌套;也就是说,折叠的循环之间没有干预代码,也没有任何OpenMP杂注"
我认为这意味着不允许在 for(i) 循环之前和之后使用代码。
相关文章:
- 如何声明特征矩阵,然后通过嵌套循环初始化它
- 了解嵌套循环打印星号图案
- 无法掌握嵌套循环的写作技巧
- 在 c++ 中实现嵌套循环的更短方法吗?
- 从嵌套循环中的 std::list 中删除将返回访问冲突
- 毕达哥拉斯三重嵌套循环误解
- T(n) 表示嵌套循环
- 2 个嵌套循环的时间复杂度
- 嵌套循环背后的逻辑
- 使用 %s C++嵌套循环
- 嵌套循环和重复迭代器
- 如何在 c++ 下使用嵌套循环和正则表达式降低时间复杂度?
- C++在乘法图中放置随机值(嵌套循环)
- 如何使用 OpenMP 减少嵌套循环?
- 为什么使用 2 个嵌套循环 O(n^2) 复杂度来解决二和问题,当只改变循环计数器逻辑时运行得更快?
- 学习嵌套循环C++与示例混淆
- 如何在CUDA中嵌套循环
- std::vector上的嵌套循环
- 具有动态数组分配的OpenMP嵌套循环
- 两个嵌套循环的运行时间复杂性:二次型还是线性