Re: [問題] CUDA cudaMalloc 執行錯誤

看板C_and_CPP (C/C++)作者 (嚕嚕嚕)時間12年前 (2013/07/30 17:06), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《Ohwil (LDPC)》之銘言: : 開發平台(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   那一行 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 這行??  Total amount of global memory : 程式碼(Code):(請善用置底文網頁, 記得排版) : 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.58.34
文章代碼(AID): #1Hzu8W1z (C_and_CPP)
討論串 (同標題文章)
文章代碼(AID): #1Hzu8W1z (C_and_CPP)