OpenMP 是一个编译器指令和库函数的集合,主要是为共享式存储计算机上的并行程序设计使用的。

0. 一段使用 OpenMP 的并行程序

#include <stdio.h>
#include <omp.h>
main() {
int id;
#pargma omp parallel
id = omp_get_thread_num();
print("Greetings from process %d!\n", id);
}

<omp.h> 中的 omp_get_thread_num() 函数返回的是当前节点的计算核心数,如果当前结点的配置为 2 个 Xeon E5-2692v2 的 12 核处理器,则一共 2*12 = 24 个计算核心。

1. 杂项

  • Undefined reference to `omp_get_max_threads_’

    gcc - Undefined reference to omp_get_max_threads

    这是因为在使用 gcc 编译器编译(链接)源程序时,未加入 -fopenmp 选项以使 OpenMP 工作,(对于其他编译器,选项名不同,intel:-openmp,pgi:-mp)


Guide into OpenMP: Easy multithreading programming for C++

OpenMP 并行程序设计入门的更多相关文章

  1. OpenMP并行程序设计——for循环并行化详解

    在C/C++中使用OpenMP优化代码方便又简单,代码中需要并行处理的往往是一些比较耗时的for循环,所以重点介绍一下OpenMP中for循环的应用.个人感觉只要掌握了文中讲的这些就足够了,如果想要学 ...

  2. OpenMP并行程序设计

    1.fork/join并行执行模式的概念 2.OpenMP指令和库函数介绍 3.parallel 指令的用法 4.for指令的使用方法 5 sections和section指令的用法 1.fork/j ...

  3. openMP编程(上篇)之并行程序设计

    openMP简介 openMP是一个编译器指令和库函数的集合,主要是为共享式存储计算机上的并行程序设计使用的. 当计算机升级到多核时,程序中创建的线程数量需要随CPU核数变化,如在CPU核数超过线程数 ...

  4. Entity Framework 程序设计入门二 对数据进行CRUD操作和查询

    前一篇文章介绍了应用LLBL Gen生成Entity Framework所需要的类型定义,用一行代码完成数据资料的读取, <LLBL Gen + Entity Framework 程序设计入门& ...

  5. OpenMP并行编程

    什么是OpenMP?“OpenMP (Open Multi-Processing) is an application programming interface (API) that support ...

  6. 程序设计入门——C语言 习题汇总

    <img width="108" height="40" alt="浙江大学" src="http://imgsize.ph ...

  7. 《并行程序设计导论》——MPI(Microsoft MPI)(1):Hello

    =================================版权声明================================= 版权声明:原创文章 禁止转载  请通过右侧公告中的“联系邮 ...

  8. 【CUDA并行程序设计系列(1)】GPU技术简介

    http://www.cnblogs.com/5long/p/cuda-parallel-programming-1.html 本系列目录: [CUDA并行程序设计系列(1)]GPU技术简介 [CUD ...

  9. 《CUDA并行程序设计:GPU编程指南》

    <CUDA并行程序设计:GPU编程指南> 基本信息 原书名:CUDA Programming:A Developer’s Guide to Parallel Computing with ...

随机推荐

  1. /bin/bash^M: bad interpreter: 没有那个文件或文件夹

    执行脚本时出现了这样一个错误,打开之后并没有找到所谓的^M,查了之后才知道原来是文件格式的问题,也就是linux和windows之间的不全然兼容... 详细细节无论,假设验证: vim test.sh ...

  2. Java反射学习总结二(用反射调用对象的私有属性和方法)

    大家都知道正常的调用是不可以访问对象的private修饰的属性和方法的,这也是Java的封装性原则. 但是有没有方法可以强制去访问对象的private修饰的属性和方法呢?那就是用反射!(这个可能在面试 ...

  3. mac os 虚拟机安装

    https://blog.csdn.net/u011415782/article/details/78505422 感谢

  4. thinkphp 获取url参数,汉字获取不到

    //这样获取不到 dump($_GET['car_code']); //这样就可以获取了 dump(iconv("gb2312","utf-8",$_GET[' ...

  5. angular自定义管道

    原文地址 https://www.jianshu.com/p/5140a91959ca 对自定义管道的认识 管道的定义中体现了几个关键点: 1.管道是一个带有“管道元数据(pipe metadata) ...

  6. [Recompose] Compute Expensive Props Lazily using Recompose

    Learn how to use the 'withPropsOnChange' higher order component to help ensure that expensive prop c ...

  7. [Node.js] Use Realm Object Database with Node.js

    Realm is an ACID compliant object database. In this lesson, you will learn how to install Realm, def ...

  8. poj 2955 Brackets 括号匹配 区间dp

    题意:最多有多少括号匹配 思路:区间dp,模板dp,区间合并. 对于a[j]来说: 刚開始的时候,转移方程为dp[i][j]=max(dp[i][j-1],dp[i][k-1]+dp[k][j-1]+ ...

  9. Python 语法细节(Python 2.x 与 Python 3.x 语法差异)

    Language differences and workarounds 查询 Python 语言版本: >> import sys >> sys.version '3.5.2 ...

  10. [React] Normalize Events with Reacts Synthetic Event System

    Event handlers are passed an instance of SyntheticEvent in React. In this video we'll take a look at ...