`
923723914
  • 浏览: 635812 次
文章分类
社区版块
存档分类
最新评论

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 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 Lets you specify that a section of code should be executed on a single thread, not necessarily the master thread.

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

7.#pragma omp for reduction 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.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics