为什么访问两个连续元素的线程会导致“银行冲突”?

longlongqin

银行冲突

如上图红框所示,我不明白为什么一个线程连续访问两个数据数组会导致bank冲突,但是下面的访问,如下图,不会引起冲突。

没有银行冲突

谢谢你的回答!!!

堕落者 堕落者

https://developer.nvidia.com/blog/using-shared-memory-cuda-cc/

共享内存库冲突

To achieve high memory bandwidth for concurrent accesses, shared memory is divided into equally sized memory modules (banks) that can be accessed simultaneously. Therefore, any memory load or store of n addresses that spans b distinct memory banks can be serviced simultaneously, yielding an effective bandwidth that is b times as high as the bandwidth of a single bank.

However, if multiple threads’ requested addresses map to the same memory bank, the accesses are serialized. The hardware splits a conflicting memory request into as many separate conflict-free requests as necessary, decreasing the effective bandwidth by a factor equal to the number of colliding memory requests. An exception is the case where all threads in a warp address the same shared memory address, resulting in a broadcast. Devices of compute capability 2.0 and higher have the additional ability to multicast shared memory accesses, meaning that multiple accesses to the same location by any number of threads within a warp are served simultaneously.

Let's assume that there are 8 memory banks of size 4 bytes for your example of parallel reduction. Element i is served by bank i % 8.

然后,在第一个示例中,bank 0、2、4、6 需要处理两个请求。

在第二个例子中,每家银行只需要处理一个请求。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

为什么以不同顺序解锁两个锁定的银行帐户会导致死锁?

为什么这两个指针访问相同的元素?

为什么以下使用IOmniThreadPool的代码会导致访问冲突?

为什么vkCreateSwapchainKHR会导致访问冲突为0?

为什么更正“可选参数”会导致访问冲突?

为什么缓存的线程池会创建两个线程,为什么关闭它会改变它呢?

为什么Java中两个短值的按位与运算会导致int值?

为什么Java中的两个嵌套类会导致异常?

为什么相同的代码会导致两个不同的图表?

为什么在飞镖中将两个double相乘会导致非常奇怪的数字

为什么这两个功能会导致网站其他部分出现故障?

为什么两个数字相减会导致NAN

为什么在同一内核中的两个线程(超线程)比两个内核中的L1写访问访问性能最差?

wsimport两个声明导致冲突

为什么这会导致访问冲突?

为什么仅创建两个时,“ ps”会列出> 2个Java线程/“轻量级进程”?

为什么未初始化的指针会导致mem访问冲突接近于0?

为什么在比较两个对象时.equals()会导致断言错误……但仅在某些情况下?

为什么两个.C文件中的相同命名专用函数会导致多个定义错误?

为什么它看起来像两个线程都在我的代码访问一个锁?

为什么两个 getline() 导致没有输入?

为什么java ExecutorService newSingleThreadExecutor产生两个线程?

为什么 actionPerformed 是由两个线程执行的?

为什么通过使用join子句连接两个相关的CSV文件会产生单个元素而不是元素序列?

为什么Flask应用会创建两个进程?

为什么替换字符会删除两个括号?

两个div元素冲突?

为什么两个看似相同的变量会产生两个不同的结果?

为什么2个线程增加一个变量会导致不同的输出