using same threadIdx for different variables

can i access different variables using the same threadIdx?
for example the nbody in GPU computing sdk, i want to modify so that the n-body problem will have different target than it source. can I used same thread for each source and target that are different?

I’m not sure I understand your question but yes, you can use threadIdx multiple times, it does not lose its value after being used.

thank for replying

let me simplify the question.

so I want to use threadId to load each value in array A then put it to a temporary variable, after that i want to use the same threadId to load values from other array with different size and put them to share memory so later I can interact the temporary variable loaded from array A with the shared memory loaded from array B.

is it possible?

Yes, no problem there. As you say A and B are of different size, be sure to use an [font=“Courier New”]if (threadIdx.x<…)[/font] clause to exclude unused threads from the memory access, so that out-of-bounds accesses are avoided.