Allocate 2D Array on Device Memory in CUDA -


How can I assign and move 2D arrays in device memory in Queue?

I found a solution to this problem. I did not have to adjust the array.

Inbuilt cudaMallocPitch () function worked. And I cudaMemcpy2D () function.

  can move device and device into array using cudaMallocPitch (zero **) and ; array, and pitch, one * Size (float), b);  

This creates a 2D array of size with the pitch passed as the parameter.

The following code creates 2D array and creates loops on the elements. It's easy to compile, you can use it.

  contains # lt; Stdio.h & gt; #to & lt include, cuda.h & gt; #define height 50 # defined width 50 / device code __global__ void kernel (float * devPtr, int pitch) {for (int r = 0; r & lt; height; ++ r) {float * row = (float *) ((Four *) devPtr + r * pitch); For (int c = 0; c  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -