Parallelization: pthreads or OpenMP?

前端 未结 6 1878
天涯浪人
天涯浪人 2020-12-23 02:00

Most people in scientific computing use OpenMP as a quasi-standard when it comes to shared memory parallelization.

Is there any reason (other than readability) to u

6条回答
  •  礼貌的吻别
    2020-12-23 02:31

    OpenMP is ideal when you need to perform the same task in parallel (that is, on multiple data), a kind of SIMD machine (single-instruction multiple-data).

    Pthreads is needed when you want to perform (quite different) tasks in parallel such as, for example, reading data in one thread and interacting with the user in another thread.

    See this page:

    http://berenger.eu/blog/c-cpp-openmp-vs-pthread-openmp-or-posix-thread/

提交回复
热议问题