Fundamentals of GPU programming (2)

Parallelism and GPU Architecture

CPU is optimized to process a single sequence of instructions. It is extremely fast but there are some walls, such as memory, power, and instruction level parallelism.

Two speedup ways.
Given a process that requires time T T T, we can use P P P processors to reduce the processing time to ideally T / P T/P T/P.

  • task parallelism. Break the problem up into T > = P T>=P T>=P tasks and pass them off to a process.
  • data parallelism. Break the input/output data into D > = P D>=P D>=P subsets and lauch one thread for each piece of data.

Task Prallelism

Assign the first P tasks to a process --> When any processor finishes a task T n T_n Tn, move to task T P + 1 T_{P+1} TP+1 --> Repeat until all tasks are completed

This has generally been the primary model for cluster computing and supercomputing.

Data Prallelism

Send the first P threads on different processors --> once any thread T n T_n Tn completes, lauch another thread --> Repeat until all threads have completed

SIMD --Single instruction multiple data

  • All cores execute the same instruction and different data can be used.

Guiding principles

CPU is always faster for a serial process and small data. On GPU, every instruction is important. There might be stalls when if statement or loops with viriable numbers of iterations occur.

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值