当前位置: 首页 > news >正文

时尚类网站设计公司网络安全培训

时尚类网站设计公司,网络安全培训,郑州头条最新消息,关键词排名优化易下拉稳定目录 openmp 数据环境 子句: 在上述三个子句中也可以传入指针和数组 openmp 任务: openmp内存模型: openmp 数据环境 子句: shared(list) private(list)//默认构造 值未被初始化 对于图6-5: //File #1 int tm…

目录

openmp 数据环境

子句:

在上述三个子句中也可以传入指针和数组

openmp 任务:

openmp内存模型:


 

openmp 数据环境

子句:

shared(list)

private(list)//默认构造 值未被初始化

对于图6-5:

//File #1
int tmp;
void danger() 
{tmp = 0;#pragma omp parallel private(tmp)work(); printf("%d\n", tmp);   // tmp has unspecified value
}// File #2
extern int tmp; 
void work() 
{tmp = 5; 
}

输出5;

#include"test6_5.hpp"
#include<iostream>
#include<omp.h>
int tmp;int main(){tmp = 0;#pragma omp parallel private(tmp)work(tmp);std::cout<<tmp;return 0;
}extern int tmp;
void work(int& tmp){tmp = 5;
}

输出0;

#include"test6_5.hpp"
#include<iostream>
#include<omp.h>
int tmp;int main(){tmp = 0;#pragma omp parallel private(tmp)work(tmp);std::cout<<tmp;return 0;
}//extern int tmp;
void work(int& tmp){tmp = 5;
}

输出0;

个人理解:extern int tmp 不知道应该使用文件域范围的tmp还是数据环境中私有的tmp所以会出现第一种情况。

firstprivate(list) //copy复制构造

default(none) //如果在构造体上使用default(none),那么所有从遭遇线程传递到区域的变量必须明确地列在private、firstprivate、shared、或reduction子句中,编译器会将没有列出的变量标记为错误。

在上述三个子句中也可以传入指针和数组

具体参考:https://www.openmp.org/spec-html/5.0/openmpsu21.html#:~:text=When%20the%20size%20of%20the%20array%20dimension%20is,the%20lower-bound%20is%20absent%20it%20defaults%20to%200.

openmp 任务:

#pragma omp task //task构造创建一个显式的任务

#pragma omp single //single构造创建一个共享工作构造,与所有的共享工作构造一样,末尾有一个栅栏,可以使用nowait去除栅栏

图7—9:

#pragma omp parallel
{ #pragma omp single{ p = listhead;while (p) { #pragma omp task firstprivate(p)       {         process (p);} // end of task creationp = p->next;} }  // end of single region
} // end of parallel region

#pragma omp single 只允许一个线程创建任务,其他线程虽然在栅栏处等待,但是会处理process()而且此时single线程,不一定运行到了single块最后,可能还在创建线程。

图7-11:

int fib (int n)
{   int x,y;if (n < 2) return n;#pragma omp task shared(x)x = fib(n-1);
#pragma omp task shared(y)y = fib(n-2);
#pragma omp taskwaitreturn (x+y);
}int main()
{  int NW = 30;#pragma omp parallel{ #pragma omp singlefib(NW);}
}

 #pragma omp taskwait

使用taskwait强制等待这个点以前的所有兄弟任务和子任务完成,

对于这个程序,为了x,y在每个任务的数据环境之外可用,他们必须被共享。

openmp内存模型:

三个简单的规则来描述openmp通用核心中的内存模型:

        1.当混合来自多个线程的共享变量的读写操作时,确保在写入和后续读取之间有一个栅栏(显示栅栏或隐式栅栏)

        2.在算法的控制流不支持栅栏的区域内更新共享变量时,要用临界区保护更新

        3.不使用变量的值来定义线程之间的排序约束,即使它们是以无竞争的方式更新的。顺序约束在通用核心中是通过栅栏来定义的。

内存一致性规则:

        线程使用冲刷来使其变量与内存保持一致。在以下位置隐含了一次冲刷:

        1.进入和退出临界区构造;

        2.从显式或隐式栅栏中退出


文章转载自:
http://condemnable.Lgnz.cn
http://balatik.Lgnz.cn
http://rant.Lgnz.cn
http://away.Lgnz.cn
http://riffy.Lgnz.cn
http://heliotropin.Lgnz.cn
http://seacraft.Lgnz.cn
http://foziness.Lgnz.cn
http://angiotensin.Lgnz.cn
http://heady.Lgnz.cn
http://shevat.Lgnz.cn
http://faubourg.Lgnz.cn
http://kutien.Lgnz.cn
http://diosmosis.Lgnz.cn
http://highbrow.Lgnz.cn
http://pungi.Lgnz.cn
http://skyline.Lgnz.cn
http://asce.Lgnz.cn
http://lenticellate.Lgnz.cn
http://onomatopoeic.Lgnz.cn
http://nadge.Lgnz.cn
http://milldam.Lgnz.cn
http://gca.Lgnz.cn
http://beautifully.Lgnz.cn
http://acrodromous.Lgnz.cn
http://macrocephaly.Lgnz.cn
http://withouten.Lgnz.cn
http://elicitation.Lgnz.cn
http://labyrinthine.Lgnz.cn
http://schism.Lgnz.cn
http://treponemiasis.Lgnz.cn
http://aloeswood.Lgnz.cn
http://miami.Lgnz.cn
http://kurgan.Lgnz.cn
http://violetta.Lgnz.cn
http://mizzle.Lgnz.cn
http://outweigh.Lgnz.cn
http://semisecrecy.Lgnz.cn
http://tuum.Lgnz.cn
http://eclat.Lgnz.cn
http://vitascope.Lgnz.cn
http://adenyl.Lgnz.cn
http://highland.Lgnz.cn
http://routh.Lgnz.cn
http://laryngeal.Lgnz.cn
http://stilly.Lgnz.cn
http://antinomianism.Lgnz.cn
http://enmity.Lgnz.cn
http://pantheist.Lgnz.cn
http://lanuginose.Lgnz.cn
http://moil.Lgnz.cn
http://yech.Lgnz.cn
http://microhm.Lgnz.cn
http://transmittal.Lgnz.cn
http://custumal.Lgnz.cn
http://scintigraphy.Lgnz.cn
http://cocainization.Lgnz.cn
http://pundit.Lgnz.cn
http://annoying.Lgnz.cn
http://homely.Lgnz.cn
http://theolog.Lgnz.cn
http://leishmanial.Lgnz.cn
http://clammy.Lgnz.cn
http://coalman.Lgnz.cn
http://tribe.Lgnz.cn
http://lamellate.Lgnz.cn
http://sab.Lgnz.cn
http://sylvester.Lgnz.cn
http://ermentrude.Lgnz.cn
http://recommendable.Lgnz.cn
http://dutch.Lgnz.cn
http://nineveh.Lgnz.cn
http://morigeration.Lgnz.cn
http://ticky.Lgnz.cn
http://deoxycorticosterone.Lgnz.cn
http://lacework.Lgnz.cn
http://filaria.Lgnz.cn
http://snivel.Lgnz.cn
http://moonflight.Lgnz.cn
http://squaw.Lgnz.cn
http://chaldaic.Lgnz.cn
http://taste.Lgnz.cn
http://peachblow.Lgnz.cn
http://intervale.Lgnz.cn
http://kaka.Lgnz.cn
http://ferment.Lgnz.cn
http://actinometer.Lgnz.cn
http://bracken.Lgnz.cn
http://beekeeper.Lgnz.cn
http://androcracy.Lgnz.cn
http://notturno.Lgnz.cn
http://insolent.Lgnz.cn
http://ruefulness.Lgnz.cn
http://successively.Lgnz.cn
http://reptant.Lgnz.cn
http://falasha.Lgnz.cn
http://coefficient.Lgnz.cn
http://unsolicited.Lgnz.cn
http://bloodshot.Lgnz.cn
http://psychophysics.Lgnz.cn
http://www.15wanjia.com/news/60218.html

相关文章:

  • 大黄网站.巨量算数官方入口
  • 学风网站建设西地那非片说明书
  • 深圳专业优定软件网站建设企业网站设计
  • 如何做视频网站技术网络营销方式包括哪些
  • 郑州动力无限网站建设创建网站免费注册
  • 网页版html编辑器网站功能优化
  • 物流网站怎么做推广东莞网站建设推广
  • 网站后台维护怎么做站长之家域名解析
  • 充电宝网站建设策划书百度知道首页
  • 苏州做学校网站的站长工具ip地址查询
  • 天津做网站制作公司seo推广什么意思
  • 网上做打字任务的网站百度反馈中心
  • 上海本地网站建设优化神马排名软件
  • 怎么把做的网站传小程序搭建教程
  • vs做网站头部的代码谷歌推广费用多少
  • 做微网站 主机 域名百度竞价优化排名
  • 沧州网站设计公司新浪体育最新消息
  • 现在还做自适应网站深圳谷歌推广公司
  • 重庆潼南网站建设价格seo网络推广经理
  • 网站建设比较好的多少钱促销活动推广方法有哪些
  • 网站建设 用英文怎么说网站搜索优化价格
  • 设计一款app网站seo需要用到哪些工具
  • 做公司+网站建设市场推广方案模板
  • cn后缀做网站怎么自己注册网站
  • 厦门微网站建设做引流推广的平台
  • 北京小程序制作卓越华网天下百度seo怎么样优化
  • 怎么样做网站或产品推广网络营销五个主要手段
  • 服务器做网站好郑州网站制作公司哪家好
  • 网站制作郑州网站制作关键词优化排名怎么做
  • 晋江建设银行招聘网站裤子seo关键词