为了运行Caffe,在Fedora 17系统中安装了CUDA6.0,某天突然发现开始菜单中有NSight Eclipse Edition,于是好奇地打开看看和Visual Studio有什么区别。
打开时过场动画如下:
弹出对话框如下,我们选择默认工程位置。
进入Eclipse后,选择File -> New -> CUDA C/C++ Project,弹出对话框如下:
工程名输入first,工程类型选择Executable/Import CUDA Sample,工具链选择CUDA Toolkit 6.0,下一步。
这里选择gencode选项,由于已经检测到GeForce610M的计算能力为2.1,我们只选PTX 2.0和GPU 2.1两项,点下一步。
这里保持默认,下一步。
仍然默认,完成。
这里打开的工程是convolutionFFT2D。在左侧Project Explorer中first文件夹上右键,选择Build Project,状态如下:
编译无误,我们可以仍然在first文件夹上右键,选择Run As... Local Application,在Console中得到输出结果如下:
[/root/cuda-workspace/first/Debug/first] - Starting... GPU Device 0: "GeForce 610M" with compute capability 2.1 Testing built-in R2C / C2R FFT-based convolution ...allocating memory ...generating random input data ...creating R2C & C2R FFT plans for 2048 x 2048 ...uploading to GPU and padding convolution kernel and input data ...transforming convolution kernel ...running GPU FFT convolution: 130.005202 MPix/s (30.768000 ms) ...reading back GPU convolution results ...running reference CPU convolution ...comparing the results: rel L2 = 8.130692E-08 (max delta = 5.342852E-07) L2norm Error OK ...shutting down Testing custom R2C / C2R FFT-based convolution ...allocating memory ...generating random input data ...creating C2C FFT plan for 2048 x 1024 ...uploading to GPU and padding convolution kernel and input data ...transforming convolution kernel ...running GPU FFT convolution: 40.667351 MPix/s (98.359001 ms) ...reading back GPU FFT results ...running reference CPU convolution ...comparing the results: rel L2 = 8.405842E-08 (max delta = 5.613083E-07) L2norm Error OK ...shutting down Testing updated custom R2C / C2R FFT-based convolution ...allocating memory ...generating random input data ...creating C2C FFT plan for 2048 x 1024 ...uploading to GPU and padding convolution kernel and input data ...transforming convolution kernel ...running GPU FFT convolution: 46.281297 MPix/s (86.428001 ms) ...reading back GPU FFT results ...running reference CPU convolution ...comparing the results: rel L2 = 8.385063E-08 (max delta = 5.613083E-07) L2norm Error OK ...shutting down Test Summary: 0 errors Test passed
可见运行成功。本文工程可在 这里下载。