i am buj… new to cuda , i want know how to write the program for 2 dimensionla array … i have seen in programming guide 2.0 … but tat is not clear… help me any one how to copy memory host to device and how to declare host and device variable for 2d arry … plse kindly
write entire the program for below mentioned… thing is i i used 2d variable is declared like as *(*a+N)+N)… but getting errors.
Do you mean you’re using an array of arrays? Its type is (float**)?
This is a little tricky to use in CUDA. You will have to call cudaMalloc() and cudaMemcpy() multiple times, keeping in mind the rules for dealing with device memory and device memory pointers.
It’s usually better to turn a 2D array into a 1D array, and index it like array[y*width + x].
i want know how to declare A ,B,C and how to allocate memory for host and device… if you dont mind can you write those functions and declaration for // A[10][10] ,B[10][10] , C[10][10], using thse variables i want add A and B arrays and rusult will be in C …
but i am not getting any where for how to declare variables … if you dnt mind plse write one sample program for using two dimensional arry… and how to allocate memoery for host and device along with memory copy from host to device … plese try to understand … i am new to cuda… i am very much intreasting to learn this language… plse help me sir