threadIdx.x stands for the thread-ID of the thread that is executing the statement.
Thus when threadId 0 executes the code, it initializes “i” to 0.
When threadId 1 executes the code, it initialies it to 1 and so on.
Thus if “i” is a common variable to all threads, the statement “i=threadIdx.x” does NOT make any sense. Usually, “i” would be a local variable – which would be local to the thread that executes. Hope that clarifies.
threadID is NOT fully qualified. To fully qualify a threadId, you need to specify blockId as well as the threadId. Thus <blockId, threadId> forms a fully qualified identifier for a thread.
Say you spawn 100 blocks with 100 threads each… the threads can be enumerated like this.