how to use __device__ or __constant__ array

Could anybody show me example of using arrays in device memory?
Say I have 20 arrays
device float *da1,*da2,*da3, …, *da10;
device float *ca1,*ca2,*ca3, …, *ca10;
and function
global do_something ()
How should I prepare, allocate and etc this arrays?

I recommend reading the book “CUDA by Example”, by Sanders and Kandrot: it will introduce you very gradually in this topics.

Concerning your question, you should declare the array in a C-like fashion (float *foo;) on the host side,
allocate some memory space by cudaMalloc, transfer the data from host to device by cudaMemcpy, do the computations on the device, and transfer back the results again by cudaMemcpy. Finally, you should use cudaFree when you do not need anymore the allocated memory space. This will put the array in the global memory of the GPU.

But description of using memory (malloc, memcpy) is not new for me. And it didn’t help yet. May be I did something wrong, so i decided to ask correct example using device and constant.