English 中文(简体)
2005年和1169年(多面界定的符号)使用CUDA __device__ 功能时的链接错误(按违约计算应为线)
原标题:Linker errors 2005 and 1169 (multiply defined symbols) when using CUDA __device__ functions (should be inline by default)

这个问题与以下方面密切相关:

A. • 如何将《世界人权宣言》的法典分为多个档案

B. Link 《2005年卡纳克里试图将数份《世界人权宣言》文件汇编为

Following advice from here: https://meta.stackexchange.com/questions/42343/same-question-but-not-quite and here https://meta.stackexchange.com/questions/8910/asking-a-similar-but-not-the-same-question

我正在提出一个非常相似的问题,但我想绝对清楚我的问题与上述问题之间的区别。

我正在把标题中的链接器错误列入多个来源档案中,该档案载有“条码”__device__功能的定义。

这与A链接不同,因为<代码>__kernel__功能,device__。 根据《世界人权宣言》手册,这意味着<代码>inline:

In device code compiled for devices of compute capability 1.x, a __device__ function is always inlined by default. The __noinline__ function qualifier however can be used as a hint for the compiler not to inline the function if possible (see Section E.1).

联系B更为相关(一个答案正确地指出,看上去看不看手册所说的话),而是将B连接起来,指由NVIDIA运送的头盔,而不是由自己的头盔运送,而这个问题很可能属于我的头部档案,但最不可能出现在NVIDIA的头号档案中。 换言之,联系B和我的问题可能有不同的答案。

同时,我发现,宣布“条码”__device__在中解决了这一问题,因此,上述只是为了记录世界其他地区的解决办法。

公开的问题是这种行为的原因。

可能的解释 我来了:

  • The manual is wrong
  • nvcc -arch=compute_11 does not qualify as "compiling for devices of compute capability 1.x" or there is a bug in nvcc
  • this is MS-VS specific and does work on platforms tested by NVIDIA
  • I have a severe misconception about how inline works. A non cuda related example ca ne found here: Multiply defined linker error using inlined functions My understanding is the one expressed by "caf" there that "the compiler shouldn t generate an external definition of the function, so it shouldn t bother the linker" others over there seemed to disagree.

我非常想知道,如果有更多的人能够澄清这里发生的情况。

最佳回答

在MS VS,以及在gcc和其他可能的汇编者(但不是在您的“多定义的链接错误”的参照中)中,在线意味着默认。 您可以强制规定一种功能是外部的内线,但是,除非你这样做,否则汇编者要么赢得了外部对该功能的定义,将其标记为安全,可以重复某种方式。

HOWEVER, no where in the documentation does it states that CUDA __device__ functions are effective declaration inline (and 因此是静止的)。 文件指出,这一功能是“因违约而走路”。 存在微妙的差异。

问题回答

暂无回答




相关问题
How to speed up Visual Studio 2008? Add more resources?

I m using Visual Studio 2008 (with the latest service pack) I also have ReSharper 4.5 installed. ReSharper Code analysis/ scan is turned off. OS: Windows 7 Enterprise Edition It takes me a long time ...

Trouble with VS.PHP installing it s own Apache server

I tried installing VS.PHP some time ago. I was intent on seeing how it works with my current setup. I immediately encountered trouble: none of my sites wanted to render. On windows, I m using WAMP ...

Jquery and Intellisense in VS 2008 with hotfix and SP1

I followed Scott Guthrie s instructions as outlined at http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx but no avail: intellisense still doesn t work. Any tips?

Fixing "error C2065: undeclared identifier"

First off, I m completely out of my depth here. So the question might be the wrong one to ask, but here goes... As per the accepted answer to this question, I m trying to compile the bindings for the ...

View whitespace in VS2008

After Jeph most recent post: http://www.codinghorror.com/blog/archives/001310.html, I thought to myself it would be fun to see if any of my code has those trailing whitespaces. So I open Visual ...

热门标签