安装好cuda,使用Visual Studio进行编程,会发现代码没有高亮和智能提示功能,为了更加方便的进行cuda程序的高效编程,通过一些插件安装和环境配置可以完美实现,接下来开始进行配置。
1、下载Visual Assist插件,进行安装,下载地址如下:
https://www.wholetomato.com/downloads
也可以参考连接,本人环境是vs2015,因此直接安装即可用
https://blog.csdn.net/hhhuang1991/article/details/79772668
2、安装完成打开vs,上方菜单榄会出现Visual Asstist图标
接下来可以参考该连接进行操作
https://www.cnblogs.com/huliangwen/articles/5003680.html
3、配置注册表,增加cu,cuh
4、重启打开vs,进行编程测试代码如下:
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
//cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size);
__global__ void hellocuda()
{
printf("Hello!!!!! I'm threas in block:%d\n", blockIdx.x);
}
int main()
{
hellocuda << <16, 1 >> > ();
cudaDeviceSynchronize();
printf("All threads are finished!\n");
return 0;
}
5、已经可以高亮显示和提示代码,会有些红色警告,可以忽视,不影响程序运行。工欲善其事必先利其器。可以留言交流。