# Grouping of threads into warps

**URL:** <https://forums.developer.nvidia.com/t/grouping-of-threads-into-warps/7999>\
**Category:** CUDA Programming and Performance\
**Created:** [February 25, 2009, 10:31pm UTC](https://forums.developer.nvidia.com/t/grouping-of-threads-into-warps/7999 "2009-02-25T22:31:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sidxavier](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@sidxavier](https://forums.developer.nvidia.com/u/sidxavier)\
**Post date:** [February 25, 2009, 10:31pm UTC](https://forums.developer.nvidia.com/t/grouping-of-threads-into-warps/7999/1 "2009-02-25T22:31:40Z")

</div>

I know that 32 threads are grouped into a warp and a half warp (16 thrds) are executed in SIMD fashion.  
Question 1: Do these threads of a single warp have some pattern as in thread number 0 to 31 in warp 1… 32 to 63 in warp 2… smthing like that?  
if yes then Question 2: if i have defined a 2D block size ie i have threadIdx.x and threadIdx.y then how do i calculate the 1D thread number for each thread? Will it be threadIdx.x_blocksize.y +threadIdx.y OR threadIdx.y_blocksize.x +threadIdx.x?

I ask this question because i am storing uchar(1byte) data in the shared memory and accessing it according to the thread ids. Now to reduce the bank conflicts i wanna program in a way that groups of 16 threads do not have any bank conflicts thus i must know which threads will be grouped together in warps

Thanks.

---

<div class="post-metadata">

**Author:** ![Jamie\_K](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Jamie\_K](https://forums.developer.nvidia.com/u/Jamie_K)\
**Post date:** [February 25, 2009, 10:37pm UTC](https://forums.developer.nvidia.com/t/grouping-of-threads-into-warps/7999/2 "2009-02-25T22:37:32Z")

</div>

Question 1: yes, as per the programming guide, pages 15-16.  
Question 2: threadIdx.y\*blockDim.x +threadIdx.x as per the programming guide, page 8.
