[問題] CUDA cudaMalloc 執行錯誤
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
MS VC2010 express
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
CUDA
問題(Question):
float data[16384];
int ans_cuda[16384];
cudaMalloc((void**)&data_cuda, sizeof(float)*length);
err = cudaGetLastError();
if( cudaSuccess != err) printf("Cuda error4: %s.\n", cudaGetErrorString(err) );
err = cudaMalloc((void**)&cuda , sizeof(int )*length);
if( cudaSuccess != err) printf("Cuda error3: %s.\n",cudaGetErrorString(err) );
err = cudaMemcpy(data_cuda, data, sizeof(float)*length,cudaMemcpyHostToDevice);
length =8192 cudaGetErrorString(err) 沒任何訊息 (應該ok?...)
length =9216 cudaGetErrorString(err) 為 invalid argument
我的deviceQuery http://imgur.com/xVUeZTu

err = cudaMemcpy(ans_cuda, cuda, sizeof(int )*length, cudaMemcpyDeviceToHost);
所以計算出來的也同步一起對 或一起錯
另外想問 我的顯卡GT540M
每個block 最大的thread為1024
我想知道這種
dim3 dimGrid(1,1,1);
dim3 dimBlock(BLOCK_SIZE, BLOCK_SIZE,BLOCK_SIZE);
根據我的device該怎麼設定
還有 該看哪裡可以知道 cudaMalloc 的最大size呢?
是 Total amount of shared memory per block: 49152 bytes 這行??
程式碼(Code):(請善用置底文網頁, 記得排版)
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 112.105.78.136
→
07/27 14:51, , 1F
07/27 14:51, 1F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章