为CUDA内核调用设置VS 2010 Intellisense [英] Setting up VS 2010 Intellisense for CUDA kernel calls

查看:383
本文介绍了为CUDA内核调用设置VS 2010 Intellisense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始CUDA编程,它的表现相当不错,我的GPU被认可和一切。我在Visual Studio中使用这个非常有用的指南部分设置了Intellisense:
http://www.ademiller.com/blogs/tech/2010/10/visual-studio-2010 -adding-intellisense-support-for-cuda-c /

I've just started CUDA programming and it's going quite nicely, my GPUs are recognized and everything. I've partially set up Intellisense in Visual Studio using this extremely helpful guide here: http://www.ademiller.com/blogs/tech/2010/10/visual-studio-2010-adding-intellisense-support-for-cuda-c/

,其中:
http: //www.ademiller.com/blogs/tech/2011/05/visual-studio-2010-and-cuda-easier-with-rc2 /

但是,Intellisense仍然不会接受这样的内核调用:

However, Intellisense still doesn't pick up on kernel calls like this:

// KernelCall.cu
#include <iostream>
#include "cuda.h"
#include "cuda_runtime.h"
#include "device_launch_parameters.h"

__global__ void kernel(void){}

int main()
{
    kernel<<<1,1>>>();

    system("pause");
    return 0;
}

行内核<<红色下划线,特别是第一个箭头左边的一个箭头,错误显示为错误:预期和表达式。但是,如果我将鼠标悬停在该函数上,它的返回类型和参数会正确显示。它仍然编译很好,我只是想知道如何摆脱这个小麻烦。

The line kernel<<<1,1>>>() is underlined in red, specifically the one arrow to the left of the first one with the error reading "Error: expected and expression". However, if I hover over the function, its return type and parameters are displayed properly. It still compiles just fine, I'm just wondering how to get rid of this little annoyance.

推荐答案

Visual Studio提供IntelliSense C ++,火箭科学家的博客的诀窍基本上是依靠CUDA-C对C ++的相似性,没有更多。

Visual Studio provides IntelliSense for C++, the trick from the rocket scientist's blog is basically relying on the similarity CUDA-C has to C++, nothing more.

在C ++语言中,正确解析角度括号是麻烦的。您有< 小于和用于模板,<< 作为shift,记住不要之前,我们不得不在嵌套的模板声明之间加一个空格。

In the C++ language, the proper parsing of angle brackets is troublesome. You've got < as less than and for templates, and << as shift, remember not long ago when we had to put a space in between nested template declarations.

原来,NVIDIA提出这种语法的家伙不是一个语言专家,并发生了选择最差的分隔符,然后三倍,它,你会有麻烦。非常惊讶的是Intellisense在它看到这一切的工作。

So it turns out that the guy at NVIDIA who came up with this syntax was not a language expert, and happened to choose the worst possible delimiter, then tripled it, well, you're going to have trouble. It's amazing that Intellisense works at all when it sees this.

我知道在CUDA中获得完整的IntelliSense的唯一方法是从运行时API切换到驱动程序API。 C ++只是C ++,CUDA仍然是(类)C ++,没有<<>>> 必须工作。

The only way I know to get full IntelliSense in CUDA is to switch from the Runtime API to the Driver API. The C++ is just C++, and the CUDA is still (sort of) C++, there is no <<<>>> badness for the language parsing to have to work around.

这篇关于为CUDA内核调用设置VS 2010 Intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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