I am trying to use a 3D texture to do trilinear interpolation. But I found my code gave errors depending on my 3D matrix size. Some matrix sizes can work well, but some don’t.

For example:

X Y Z that work:

( 4, 4, 4 ), ( 368, 176, 176 );

X Y Z gave error “cudaMemcpy3D: invalid argument”

( 256, 256, 128 ), (512, 512, 256);

X Y Z gave error “cudaMemcpy3D: invalid configuration argument”

( 368, 368, 368 ), (512, 4, 4 );

X Y Z gave error “cudaMalloc3DArray: out of memory.”

(512, 512, 512 )

Could any one help me to solve this problem. It really drove me crazy.