简体   繁体   English

本地内存比CUDA中的共享内存慢吗?

[英]Is local memory slower than shared memory in CUDA?

I only found a remark that local memory is slower than register memory, the two-per-thread types. 我只发现本地内存比寄存器内存慢,每个线程两种类型。

Shared memory is supposed to be fast, but is it faster than local memory [of the thread]? 共享内存应该很快,但它比[线程]的本地内存更快?

What I want to do is kind of a median filter, but with a given percentile instead of the median. 我想要做的是一种中值滤波器,但具有给定的百分位而不是中位数。 Thus I need to take chunks of the list, sort them, and then pick a suitable one. 因此,我需要获取列表的块,对它们进行排序,然后选择一个合适的列表。 But I can't start sorting the shared memory list or things go wrong. 但我无法开始对共享内存列表进行排序或出现问题。 Will I lose a lot of performance by just copying to local memory? 只要复制到本地内存,我会失去很多性能吗?

Local memory is just thread local global memory. 本地内存只是线程本地全局内存。 It is much, much slower (both in terms of bandwidth and latency) than either registers or shared memory. 它比寄存器或共享内存要慢得多(在带宽和延迟方面)。 It also consumes memory controller bandwidth that would otherwise be available for global memory transactions. 它还消耗了可用于全局内存事务的内存控制器带宽。 The performance impact of spilling or deliberately using local memory can be anything from minor to severe, depending on the hardware you are using and how local memory is used. 溢出或故意使用本地内存对性能的影响可能是从轻微到严重,具体取决于您使用的硬件以及本地内存的使用方式。

According to Vasily Volkov's research - see Better performance at lower occupancy ( pdf ) -- there is about a factor of 8 difference in effective bandwidth between shared memory and register on Fermi GPUs (about 1000 Gb/s for shared memory and 8000 Gb/s for registers). 根据Vasily Volkov的研究 - 在较低占用率pdf看到更好的性能 - 共享内存和Fermi GPU上的寄存器之间的有效带宽差异大约为8倍(共享内存大约为1000 Gb / s,8000 Gb / s)对于寄存器)。 This somewhat contradicts the CUDA documentation, which implies that shared memory is comparable in speed to registers. 这有点与CUDA文档相矛盾,这意味着共享内存在速度上与寄存器相当。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM