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

网站建设是管理费用的哪项费用网站开发中的qq登录

网站建设是管理费用的哪项费用,网站开发中的qq登录,wordpress分块,如何做php网站某些并行循环不需要执行所有迭代。 例如#xff0c;搜索值的算法可以在找到值后终止。 OpenMP 不提供中断并行循环的机制。 但是#xff0c;可以使用布尔值或标志来启用循环迭代#xff0c;以指示已找到解决方案。 并发运行时提供允许一个任务取消其他尚未启动的任务的功能。…某些并行循环不需要执行所有迭代。 例如搜索值的算法可以在找到值后终止。 OpenMP 不提供中断并行循环的机制。 但是可以使用布尔值或标志来启用循环迭代以指示已找到解决方案。 并发运行时提供允许一个任务取消其他尚未启动的任务的功能。 此示例演示如何将一个不需要运行所有迭代的 OpenMP parallelfor 循环转换为使用并发运行时取消机制。 示例 此示例同时使用 OpenMP 和并发运行时来实现 std::any_of 算法的并行版本。 此示例的 OpenMP 版本使用标志来协调所有满足条件的并行循环迭代。 使用并发运行时的版本使用 concurrency::structured_task_group::cancel 方法在满足条件时停止整个操作。 // concrt-omp-parallel-any-of.cpp // compile with: /EHsc /openmp #include ppl.h #include array #include random #include iostreamusing namespace concurrency; using namespace std;// Uses OpenMP to determine whether a condition exists in // the specified range of elements. template class InIt, class Predicate bool omp_parallel_any_of(InIt first, InIt last, const Predicate pr) {typedef typename std::iterator_traitsInIt::value_type item_type;// A flag that indicates that the condition exists.bool found false;#pragma omp parallel forfor (int i 0; i static_castint(last-first); i){if (!found){item_type cur *(first i);// If the element satisfies the condition, set the flag to // cancel the operation.if (pr(cur)) {found true;}}}return found; }// Uses the Concurrency Runtime to determine whether a condition exists in // the specified range of elements. template class InIt, class Predicate bool concrt_parallel_any_of(InIt first, InIt last, const Predicate pr) {typedef typename std::iterator_traitsInIt::value_type item_type;structured_task_group tasks;// Create a predicate function that cancels the task group when// an element satisfies the condition.auto for_each_predicate [pr, tasks](const item_type cur) {if (pr(cur)) {tasks.cancel();}};// Create a task that calls the predicate function in parallel on each// element in the range.auto task make_task([]() {parallel_for_each(first, last, for_each_predicate);});// The condition is satisfied if the task group is in the cancelled state.return tasks.run_and_wait(task) canceled; }int wmain() {// The length of the array.const size_t size 100000;// Create an array and initialize it with random values.arrayint, size a; generate(begin(a), end(a), mt19937(42));// Search for a value in the array by using OpenMP and the Concurrency Runtime.const int what 9114046;auto predicate [what](int n) - bool { return (n what);};wcout LUsing OpenMP... endl;if (omp_parallel_any_of(begin(a), end(a), predicate)){wcout what L is in the array. endl;}else{wcout what L is not in the array. endl;}wcout LUsing the Concurrency Runtime... endl;if (concrt_parallel_any_of(begin(a), end(a), predicate)){wcout what L is in the array. endl;}else{wcout what L is not in the array. endl;} } 本示例生成以下输出。 Using OpenMP... 9114046 is in the array. Using the Concurrency Runtime... 9114046 is in the array. 在使用 OpenMP 的版本中将执行循环的所有迭代即使设置了标志。 此外如果任务具有任何子任务则标志还必须可供这些子任务用来传达取消信息。 在并发运行时中当任务组被取消时运行时会取消整个工作树包括子任务。 concurrency::parallel_for_each 算法使用任务来执行工作。 因此当循环的一次迭代取消根任务时也会取消整个计算树。 取消工作树后运行时不会启动新任务。 但是运行时允许已经开始的任务完成。 因此对于 parallel_for_each 算法活动循环迭代可以清理其资源。 在此示例的两个版本中如果数组包含要搜索的值的多个副本则多个循环迭代可以同时设置结果并取消整个操作。 如果问题要求在满足条件时只有一个任务执行工作则可以使用同步基元如关键部分。 编译代码 复制示例代码并将它粘贴到 Visual Studio 项目中或粘贴到名为 concrt-omp-parallel-any-of.cpp 的文件中再在 Visual Studio 命令提示符窗口中运行以下命令。 cl.exe /EHsc /openmp concrt-omp-parallel-any-of.cpp
http://www.w-s-a.com/news/711046/

相关文章:

  • 企业网站的主要功能板块平台推广是做什么的
  • 网页网站自做全搞定西安建设工程信息网诚信平台
  • 网站vip怎么做建网站外包公司
  • 胶州建网站域名不备案可以正常使用吗
  • 网站建设客户开发方案软件工程师行业分析
  • 沈阳网站建设黑酷科技微信小程序怎么一键删除
  • 做网站产品搜索展示实现西安百度推广服务公司
  • 建立网站接受投注是什么意思一般使用的分辨率的显示密度是多少
  • 怎么建立一个网站开展业务网站建设人员的工资分配
  • 求职网站建设方案企业网站开发需求分析
  • 西安企业网站开发可以做哪些有趣的网站
  • 房产类网站开发云南百度建站
  • 泰州网站建设电话彩票网站怎么做代理
  • 泉州网站制作推广山西网站开发建设
  • 百度商桥怎样绑定网站百度推广登陆
  • 重庆网站建设论坛株洲论坛
  • 网站怎么做切换中英文济南广运建设公司网站
  • 网页游戏网站搭建免费建网站哪个模板多
  • 公司起名打分最准的免费网站直播网站app开发
  • 医疗器械类网站前置审批网站临时域名
  • 金融网站策划方案网站开发表格整体页面居中
  • 句容本地网站黄石下陆区建设局网站
  • 免费网站服务陕西省咸阳市建设银行网站
  • 网站建设活动计划做网站意义
  • 莱芜新闻主持人名单seo sem 外贸建站 网站建设 文化墙设计
  • 易语言可以做网站嘛赣州网站建设开发
  • 网站建设规范布局网站建设费往什么科目
  • 乐清手机网站设计哪个汽车网站汽贸店免费做
  • 网站建设课程总结报告推广软文
  • 企业网站哪里可以做烟台seo网站推广