openmp 中部分函数简介

接下来将考虑对plsa进行并行化,并行化主要包括机器之间的并行和单机多线程的并行,考虑采用omp来实现单机多线程的并行,这样既可以快速验证下算法的效率提升又可以避免把很多时间花在多线程控制上,结合算法特点,需要用到以下函数,在这里简单整理下,更多的函数参考microsoft msdn

1.omp_get_thread_num() function:Returns the thread number of the thread executing within its thread team

2.#pragma omp critical() function:Specifies that code is only be executed on one thread at a time.

3.#pragma omp parallel function:Defines a parallel region, which is code that will be executed by multiple threads in parallel.

4.#prarma omp for schedule

5.#pragma omp single function:Lets you specify that a section of code should be executed on a single thread, not necessarily the master thread.

6.#pragma omp barrier function:Synchronizes all threads in a team; all threads pause at the barrier, until all threads execute the barrier.

7.#pragma omp for reduction function:Specifies that one or more variables that are private to each thread are the subject of a reduction operation at the end of the parallel region.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值