error when copy to cuda array

Hi,
I want to copy a int4 array to cudaArray, but always get the error: invalidate argument.

int4 *cenLs = (int4 )malloc(sizesizeof(int4));
for(int i = 0; i < size; i++)
cenLs[i] = make_int4(1, 1, 1, 0);
cudaArray *d_centerArray = 0;
cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc(32, 32, 32, 32, cudaChannelFormatKindSigned);
CUDA_SAFE_CALL( cudaMallocArray(&d_centerArray, &channelDesc, size, 1) );
printf(“create cuda array: %s\n”, cudaGetErrorString(cudaGetLastError()));

cudaMemcpyToArray(d_centerArray, 0, 0, cenLs, size*sizeof(int4), cudaMemcpyHostToDevice);

printf(“copy cuda array: %s\n”, cudaGetErrorString(cudaGetLastError())); // error here: invalidate argument

Thanks a lot!

Hi,

My guess is your size is exceeding the limit of 1D arrays in CUDA

See the following post:

cudaMallocArrayBug

According to mfatica you can have 1D Cuda Arrays upto size 8192

Best Regards