simple cudaMemcpy3D question


i have question concerning about cudaMemcpy3D. i have a volume in host memory in format of char or short (InputVolumeType), how can i copy this volume into a volume on device with format float(OutputVolumeType)?

that’s what i tried so far, has this any chance of working?

//reading source data into host memory

	inputfp 		= fopen ( argv[fnameidx],"rb" );

	h_inputvolume 	= (InputVolumeType*) malloc (sizeof(InputVolumeType)* (width * height * depth));

	fread(h_inputvolume , sizeof(InputVolumeType), width * height * depth, inputfp);

	fclose( inputfp );


	//allocating memory for source volume data on GPU

	cudaExtent Extent = make_cudaExtent(width*sizeof(OutputVolumeType), height, depth);

	cudaMalloc3D (&dev_ptr,Extent);


	//setting parameters for source volume copy to GPU memory

	params.srcPtr	= make_cudaPitchedPtr((void*)h_inputvolume,width*sizeof(InputVolumeType) ,  width, height);

	params.dstPtr	= dev_ptr;

	params.extent	= Extent;

	params.kind	= cudaMemcpyHostToDevice;

	//copying source Volume to GPU

	status = cudaMemcpy3D(&params);