cudaMallocPitch()

In cudaMallocPitch( (void**) &d_src , &pitch , width * sizeof(float) , height);, is height the number of rows and width the number of columns, or the other way around? Thanks.

width = number of columns;

height = number of rows;

pitch = round of (width * sizeof(type)) and multiple of 64;

for example, assume that if we have a matrix with height = 5, width = 5 and type = “short”, so width * sizeof(short) = 10 bytes. It means that the matrix needs only 5x5xsizeof(short) = 5x10 bytes.

But when using cudaMallocPitch to allocate this matrix. Pitch = 64. so this matrix will be allocated with 5x64bytes.

I used type of data is short but it also same for float type.

Thanks a lot!