关于CUDA中共享内存库冲突的问题 [英] Questions about Shared Memory bank conflict in CUDA

查看:418
本文介绍了关于CUDA中共享内存库冲突的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道哪个陈述是真的(假设有一个128个线程的块)?(或两者都是假的)



1.如果发生内存冲突两个线程(在同一个warp中)读取/加载同一个bank。如果两个线程(不在同一个warp中)读取/加载同一个bank,则不会发生冲突。



2.如果两个线程发生内存库冲突(无论是他们在同一个经线或不同的情况下)读取/加载同一个银行。

I want to know which statement is true (suppose there is a block with 128 threads)?(or both false)

1. Memory bank conflicts occur if two threads (in the same warp) read/load the same bank. And the conflicts will not occur if two threads (not in the same warp) read/load the same bank.

2. Memory bank conflicts occur if two threads (whether they in the same warp or not) read/load the same bank.

推荐答案

2包含1. true + true



1还包含一个例外:广播。如果不是2个但是所有线程都访问同一个银行,它会被广播到所有的warp项目。



1是真的,因为共享内存序列化访问同一个银行,如果不是打算播放。



2是真的,因为共享内存同时提供多个warp。



还有来自CUDA文档的另一件事:



计算能力2.0及更高版本的设备具有多播共享内存访问的附加功能,这意味着任何数字都可以多次访问同一位置经线内的线程同时提供。
2 contains 1. true + true

1 also contains an exception: broadcasting. If not only 2 but all threads access same bank, it is broadcasted to all items of warp.

1 is true because shared memory serializes access to same bank if its not intended to broadcast.

2 is true because shared memory serves multiple warps concurrently.

There is also another thing from CUDA documentation:

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.


这篇关于关于CUDA中共享内存库冲突的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆