I try the new 3D texture supported by CUDA 2.0b. However the programming guide does not provide the API i need for the task. So I have to di something similar to simpleTexture3D example in cuda SDK.
that is
cudaMemcpy3DParms copyParams = {0};
copyParams.srcPtr = make_cudaPitchedPtr((void*)src, w *sizeof(float), w, h);
copyParams.dstArray = d_volumeArray;
copyParams.extent = volumeSize;
copyParams.kind = cudaMemcpyHostToDevice;
cudaMemcpy3D(©Params);
com_tex3_float.addressMode[0] = cudaAddressModeWrap;
com_tex3_float.addressMode[1] = cudaAddressModeWrap;
com_tex3_float.addressMode[2] = cudaAddressModeWrap;
com_tex3_float.filterMode = cudaFilterModePoint;
com_tex3_float.normalized = false;
cudaBindTextureToArray(com_tex3_float, d_volumeArray, desc);
It run correct with src is the 3D volume in the host. However, if I define a volume in device memory, and copy the contain of host volume to device, then to volume array
float* d_src;
size = w * h * l;
cudaMalloc((void**)&d_src, sizeof(float) * size);
cudaMemcpy(d_src, src, sizeof(float) *size, cudaMemcpyHostToDevice);
...............
copyParams.srcPtr = make_cudaPitchedPtr((void*)d_src, w *sizeof(float), w, h);
.....
copyParams.kind = cudaMemcpyDeviceToDevice;
.....
Now the program gives incorrect results. I can not understand what happen, it seems that i can not copy memory from device to the d_volumeArray
I try to find document about cudaMemcpy3D, but there’s nothing like that in the programming guide 2.0. Can someone tell me where i can find information about how to use 3D texture.
Thank
Linh Ha