返回介绍

Writing Parallel Code

发布于 2025-02-25 23:44:03 字数 2218 浏览 0 评论 0 收藏 0

The goal is to desing parallel programs that are flexible, efficient and simple.

Step 0 : Start by profiling a serial program to identify bottlenecks

Step 1 : Are there for opportunities for parallism?

  • Can tasks be perforemd in parallel?
    • Function calls
    • Loops
  • Can data be split and operated on in parallel?
    • Decomposition of arrays along rows, columns, blocks
    • Decomposition of trees into sub-trees
  • Is there a pipeline with a sequence of stages?
    • Data preprocesing and analysis
    • Graphics rendering

Step 2 : What is the nature of the parallelism?

  • Linear
    • Embarassingly parallel programs
  • Recursive
    • Adaptive partitioning methods

Step 3 : What is the granularity?

  • 10s of jobs
  • 1000s of jobs

Step 4 : Choose an algorihtm

  • Organize by tasks
    • Task parallelism
    • Dvidie and conquer
  • Organize by data
    • Geometric decomposition
    • Recursvie decomposition
  • Organize by flow
    • Pipeline
    • Event-based processing

Step 5 : Map to program and data structures

  • Program structures
    • Single program multiple data (SPMD)
    • Master/worker
    • Loop parallelism
    • Fork/join
  • Data structures
    • Shared data
    • Shared queue
    • Distributed array

Step 6 : Map to parallel environment

  • Multi-core shared memrory
    • Cython with OpenMP
    • multiprocessing
    • IPython.cluster
  • Multi-computer
    • IPython.cluster
    • MPI
    • Hadoop / Spark
  • GPU
    • CUDA
    • OpenCL

Step 7 : Execute, debug, tune in parallel environment

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文