CUBLAS and 2D-arrays

Hello, everyone!

I’m trying to use some 2D-arrays with CUBLAS library. All CUBLAS samples are using 1D-arrays, but I want my large project to be CUDA-powered and I’m afraid of converting it from 2D-arrays to 1D-arrays. I’m trying to allocate memory for my 2-D arrays by cudaMallocPitch function - success. After that I’m copying my arrays from host memory to device memory using cublasSetMatrix function and it finished with no errors too. But if I’m trying to copy arrays back to host memory from device memory - all my arrays are broken! It seems that cublasGetMatrix brokes host memory allocated for 2-D arrays. Does anyone have experience with 2-D arrays and CUDA?