问题描述
我读了几篇关于共享内存的好文章;但我有关于银行冲突的初始问题
据说,如果线程1和线程2访问来自银行0的字0,则没有银行冲突
,但如果他们访问不同的单词,则会有银行冲突;但我的问题是如何不同的单词可以驻留在一个银行?
由于存储体0大小是32位,字大小是32位;
I read out few good articles on shared memory; but I have initial question with respect to bank conflictsIt is said that if thread 1 and thread 2 accesses word 0 from bank 0 then there is no bank conflictbut if they access different words then there will be bank conflict; but my question is how different words can reside in a single bank?As bank 0 size is 32 bits and word size is 32 bits; there can be utmost 1 word/bank.
推荐答案
使用GPU的计算能力2. *或3. * 32个共享内存bank;但是在共享内存中可能有超过32个字(= 128B)的数据。每个银行 b
负责地址中的所有数据(例如 A%nbanks == b
:
With a GPU of compute capability 2.* or 3.*, there are 32 shared memory banks; but you might well have more than 32 words (= 128B) of data in shared memory. Each bank b
is responsible for all the data in addresses (say) A % nbanks == b
:
+--------+---------+---------+-
Bank 0 | word 0 | word 32 | word 64 |...
+--------+---------+---------+-
Bank 1 | word 1 | word 33 | word 65 |...
+--------+---------+---------+-
Bank 2 | word 2 | word 34 | word 66 |...
+--------+---------+---------+-
... | ..... | | |
+--------+---------+---------+-
Bank 30 | word 30| word 62 | word 94 |...
+--------+---------+---------+-
Bank 31 | word 31| word 63 | word 95 |...
+--------+---------+---------+-
如果每个人都访问字0,则有广播功能;但是如果线程0正在访问字0,线程1正在访问字32等,那么这些访问将被序列化。
If everyone is accessing word 0, there is "broadcast" functionality for that; but if thread 0 is accessing word 0, thread 1 is accessing word 32, etc, then those accesses will be serialized.
这篇关于银行与字大小的冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!