安裝好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、已經可以高亮顯示和提示代碼,會有些紅色警告,可以忽視,不影響程序運行。工欲善其事必先利其器。可以留言交流。