Hi,

I have a single dim array of size N, and I would like every element to be handled by a thread. I am working on Tesla1.

- How can I allocate block/threads independent of the data size?

kernel_function <<1, N >> (); ==> whatever N is, this runs 512 threads max.

Anything better than the following?

```
if (N <=1024){
block = 1;
threads = N;
}
else{
block = N/512;
threads = 512;
}
```

- On an array of size N, I would like to work on elements 1… N-1. In fact, in total I need N-1 threads.

N=1024, block =2, what should “threads” be in the following:

kernel_function <<block, threads >> ();

- If threads = 512, then I have array[N] that I don’t want to touch.
- If threads = 511, then array[512] is skipped.

Thanks!