CudaSteps/capter9/ReadMe.md

20 lines
442 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 原子函数的合理使用
cuda 中,一个线程的原子操作可以在不受其他线程的任何操作的影响下完成对某个(全局内存或共享内存)
数据的一套“读-改-写”操作。
------
## 完全在 GPU 中进行归约
有两种方法能够在GPU中得到最终结果
1. 用另一个核函数将较短的数组进一步归约;
2. 在核函数末尾利用原子函数进行归约。
------