[問題] 初學CUDA5.0 + VC2012 <<< 語法錯誤?
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
visual c++ 2012 express for windows desktop
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
cuda 5.0 + toolkit SDK (Nsight Visual Studio Edition 3.0 這個東西要安裝嗎?)
問題(Question):
我在嘗試hello world 但是 說 <<< 語法錯誤
我主要設定是參考
http://www.aimantarek.com/2011/01/how-to-make-new-cuda-project-in-vs-2010.html
這篇文章
餵入的資料(Input):
#include "stdafx.h"
#include< stdio.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#define N 7
__global__ void add_arrays(char *a, int *b)
{
a[threadIdx.x] += b[threadIdx.x];
}
int main()
{
// Setup the arrays
char a[N] = "Hello ";
int b[N] = {15, 10, 6, 0, -11, 1,0};
char *ad;
int *bd;
const int csize = N*sizeof(char);
const int isize = N*sizeof(int);
// print the contents of a[]
printf("%s", a);
// Allocate and Transfer memory to the device
cudaMalloc( (void**)&ad, csize );
cudaMalloc( (void**)&bd, isize );
cudaMemcpy( ad, a, csize, cudaMemcpyHostToDevice );
cudaMemcpy( bd, b, isize, cudaMemcpyHostToDevice );
// Perform the array addition
dim3 dimBlock( N );
dim3 dimGrid ( 1 );
add_arrays<<<dimGrid, dimBlock>>>(ad, bd); 按f5這個地方說語法錯誤
// Copy the Contents from the GPU
cudaMemcpy( a, ad, csize, cudaMemcpyDeviceToHost );
cudaFree( ad );
// Display the results
printf("%s\n", a);
return 0;
}
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
補充說明(Supplement):
我看到說 cuda_vs_wizard已經不能用
請問還有什麼最新說明 適合 初學者呢?
搞了幾天的環境設定....Orz
目前是CUDA 5.0 + VS express 2012 + toolkit SDK 加一大堆設定....
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 112.104.108.19
→
07/17 10:13, , 1F
07/17 10:13, 1F
→
07/18 01:34, , 2F
07/18 01:34, 2F
→
07/18 01:34, , 3F
07/18 01:34, 3F
→
07/18 01:36, , 4F
07/18 01:36, 4F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章