使用OPENMP编写相应的并行代码段。 [英] Write the corresponding parallel code segment using OPENMP.

查看:78
本文介绍了使用OPENMP编写相应的并行代码段。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 the_max =  0 ; 
#pragma omp parallel for
for (i = 0 ; i< n; i ++)
array [i] + = i;
the_max = myfunc(a [i],the_max);



如果这是正确的?

解决方案

< blockquote>我们不做你的作业。

亲自尝试 - 它可能比你想象的要容易。


the_max = 0;
#pragma omp parallel for
for (i=0; i<n; i++)
     array[i] +=i;
    the_max = myfunc(a[i], the_max);


if this correct?

解决方案

We don't do your homework.
Try it yourself - it may be easier than you think.


这篇关于使用OPENMP编写相应的并行代码段。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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