为什么openMP不支持在C语言中减少数组? [英] Why openMP does not support reduction for arrays in C?

查看:101
本文介绍了为什么openMP不支持在C语言中减少数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OpenMP 3.0中,特殊的结构支持Fortran缩减,而在C/C ++中,则将其委派给程序员.我想知道是否有特殊原因,因为OpenMP 3.0于2008年问世,所以我认为也有足够的时间为C/C ++实施它.是否有与C/C ++相关的任何技术原因,为什么C/C ++仍不支持该原因?

In OpenMP 3.0 in Fortran reduction is supported with the special construct, while in C/C++ it is delegated to a programmer. I was wondering if there is a special reason for that, because OpenMP 3.0 came out in 2008, so I thought it was enough time to implement it for C/C++ also. Is there any particular technical reason associated with C/C++, why it is still not supported for C/C++?

推荐答案

正如评论中提到的,默认情况下,OpenMP不支持减少数组的原因是它不知道数组的大小.默认情况下,Fortran支持减少数组,因为无论静态分配还是动态分配,Fortran始终知道其数组大小. C/C ++只知道静态数组的大小.

As was mentioned in the comments the reason for OpenMP not supporting reduction by default for arrays is that it does not know the size of an array. Fortran supports reduction on arrays by default because it always knows the size of its arrays, no matter if static or dynamically allocated. C/C++ only know the size of static arrays.

这篇关于为什么openMP不支持在C语言中减少数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆