# @cuda threads and blocks confusion

**URL:** <https://discourse.julialang.org/t/cuda-threads-and-blocks-confusion/54816>\
**Category:** GPU\
**Created:** [February 7, 2021, 9:43pm UTC](https://discourse.julialang.org/t/cuda-threads-and-blocks-confusion/54816 "2021-02-07T21:43:37Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [February 8, 2021, 2:53pm UTC](https://discourse.julialang.org/t/cuda-threads-and-blocks-confusion/54816/4 "2021-02-08T14:53:21Z")

</div>

The API has recently been simplified: [https://github.com/JuliaGPU/CUDA.jl/blob/4eb99b9f53acfc02a01f92d4a0a2b219bf8994cc/src/indexing.jl#L32-L36](https://github.com/JuliaGPU/CUDA.jl/blob/4eb99b9f53acfc02a01f92d4a0a2b219bf8994cc/src/indexing.jl#L32-L36)

But yes, it’s best to use the occupancy API. You need to extend this yourself to multiple dimensions, the occupancy API only works with 1D threads/blocks. Alternatively, just convert the linear thread index to an appropriate 2D one in your kernel.

---

_[View the full topic](https://discourse.julialang.org/t/cuda-threads-and-blocks-confusion/54816)._
