CUDA __syncthreads()编译精细,但用红色下划线 [英] CUDA __syncthreads() compiles fine but is underlined with red

查看:2979
本文介绍了CUDA __syncthreads()编译精细,但用红色下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用CUDA 4.2一个星期,我有一个小问题。
当我写__syncthreads()函数,它变成下划线,看起来是错误的...

I have been working with CUDA 4.2 for a week now and I have a little problem. When I write the __syncthreads() function it becomes underlined and looks like it is wrong...

然后如果我把鼠标放在函数写信息:

Then if I put the mouse on the function it appears a message writing:


标识符__syncthreads();是未定义的。

identifier __syncthreads(); is undefined.

但是当我编译我的项目时,输出form build:

but when i compile my project the output form build says:


========== Build:1成功,0失败,0个最新,0个跳过==========

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

所以我猜测一切正常,但事实上Visual Studio强调的功能是混乱我...如何使Visual Studio知道这个函数是在编译过程之前定义的?

So I am guessing that everything works fine but the fact that Visual Studio underlines the function is confusing me...How can I make Visual studio to know that this function is defined before the compiling process?

注意:同样的事情发生在内核调用:kernel<< >>>其中第三个<下划线也是红色的...

NOTE:The same thing happens with the kernel call: kernel<<<...,...>>> where the third "<" is underlined red too...

我知道这可能是一个小问题,但我想解决它...非常感谢!
我使用Visual Studio 2010对win7与Cuda 4.2和Nsight 2.2

I know that this probably is a minor problem but i want to solve it...Thanks a lot! I am using Visual Studio 2010 on win7 with Cuda 4.2 and Nsight 2.2

推荐答案

我添加了以下几行在cu文件的顶部开始识别这些函数。由于某种原因,Intellisense没有接收到这个#define:

I added the following few lines to the top of the cu file and it began to recognize these functions. For some reason, Intellisense did not pick up this #define:

#ifndef __CUDACC__  
    #define __CUDACC__
#endif

我在代码中丢失了一些颜色编码,但我不再有奇怪的假阳性错误。

I lost some color-coding in the code, but I no longer get strange false positive errors.

这篇关于CUDA __syncthreads()编译精细,但用红色下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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