在网上参考了各位前辈的攻略后,捣鼓了两天总算配置成功了。
目前网上多的还是ubuntu上配置CUDA的教程比较多比较详尽,但是我现在就是想在windows10上跑啊,就是想用CUDA啊。。。
1.CUDA下载
点击打开链接这个是CUDA8.0的下载网址链接,目前是最新版的。
按照下图选择好后,点击Download就OK了。
(PS:前一天我下了五六遍,每次都是到90%的时候没有下载速度了。。我也很绝望啊。然而今天又试了一遍没想到居然成功了!开心。)
2.CUDA安装
http://www.jianshu.com/p/c245d46d43f0这里参考了xushiluo前辈的资料,若有侵权,我会删除的。
下载好后直接安装就可以了,然后安装目录就用默认路径就可以。一路都是下一步下一步nextnext就行,什么选项也不用点,直到安装完成。
编译并且运行程序,效果图如下#include <iostream> #include<stdio.h> #include "cuda_runtime.h" #include "device_launch_parameters.h" bool InitCUDA() { int count; cudaGetDeviceCount(&count); if (count == 0) { fprintf(stderr, "There is no device. "); return false; } int i; for (i = 0; i < count; i++) { cudaDeviceProp prop; if (cudaGetDeviceProperties(&prop, i) == cudaSuccess) { if (prop.major >= 1) { break; } } } if (i == count) { fprintf(stderr, "There is no device supporting CUDA 1.x. "); return false; } cudaSetDevice(i); return true; } int main() { if (!InitCUDA()) { return 0; } printf("HelloWorld, CUDA has been initialized. "); system("pause"); return 0; }