Cuda Device Memory Allocation Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this http://stackoverflow.com/questions/8904433/trouble-with-cuda-memory-allocation-and-access site About Us Learn more about Stack Overflow the company Business Learn http://stackoverflow.com/questions/26223103/cuda-getting-error-when-trying-to-allocate-memory-for-integer-in-device more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Trouble memory allocation with CUDA Memory Allocation and Access up vote 0 down vote favorite I am working on learning CUDA right now. I have some basic experience with MPI so I figured I'd start with some really simple vector operations. I am trying to write a parallelized dot product thing. I am either having trouble allocating/writing memory to the CUDA device, or I am not correctly memory allocation error bringing it back to the host (cudaMemcpy()). /*Code for a CUDA test project doing a basic dot product with doubles * * * */ #include here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Cuda, getting error when trying to allocate memory for integer in device up vote 0 down vote favorite I am trying to pass in 2 2D arrays, 1 1D array and 2 integers to cudaMlloc() so that I can use it in my kernel. The 2D arrays are doubles and other is int.While the 1d array contains floats. I keep getting the error "no instance of overloaded function CudaMalloc matches the argument list.argument types are : (int,int).I dont know what I am doing wrong. The kernel and the way i used it is below: __global__ void getMatrix(double** cmatrix,int** data,float* angle,int x,int y){ int j = blockIdx.x * blockDim.x + threadIdx.x; int i = blockIdx.y * blockDim.y + threadIdx.y; int xrad,yrad; xrad = 0; yrad = 0; xrad = (int)round(cos(angle[i]) * (j+1) + x); yrad = (int)round(sin(angle[i]) * (j+1) + y); cmatrix[i][j] = (double)data[yrad-1][xrad-1]; } And the implementation is: int dataFileSize = 801 * 1201 * sizeof(int); int cmatrixSize = ANGLESIZE * RADIUS/RADSTEP * sizeof(double); int xVarSize = sizeof(int); int yVarSize = sizeof(int); int** d_data; cudaMalloc(&d_data,dataFileSize); double** d_cmatrix; cudaMalloc(&d_cmatrix,cmatrixSize); float * d_angle; cudaMalloc(&d_angle,sizeof(float) * ANGLESIZE); int *d_x; cudaMalloc((void**)&d_x,xVarSize); int *d_y; cudaMalloc((void**)d_y,yVarSize); cudaMemcpy(d_data,data,dataFileSize,cudaMemcpyHostToDevice); cudaMemcpy(d_cmatrix,cmatrix,cmatrixSize,cudaMemcpyHostToDevice); cudaMemcpy(d_angle,angle,sizeof(float) * ANGLESIZE,cudaMemcpyHostToDevice); cudaMemcpy(d_x,&x,xVarSize,cudaMemcpyHostToDevice); cudaMemcpy(d_y,&y,yVarSize,cudaMemcpyHostToDevice); const dim3 blockSize(ANGLESIZE,1,1); const dim3 threadSize(1,RADIUS/RADSTEP,1); getMatrix<<