NVIDIA / numba-cuda

BSD 2-Clause "Simplified" License
31 stars 7 forks source link

[FEA] Dim3 should act more like a `NamedTuple` #55

Open gmarkall opened 4 days ago

gmarkall commented 4 days ago

E.g. It would be convenient to be able to do things like

tuple(g * d for g, d in zip(cuda.gridDim, cuda.blockDim))

which is not presently possible with the current implementation of Dim3.

cc @brycelelbach

brycelelbach commented 4 days ago

Something like this works today:

from numba import cuda

@cuda.jit
def kernel():
  for g, d in zip((4, 1, 1), (256, 1, 1)):
    print(g * d)

kernel[1, 1]()

But it won't work with Dim3s, because they're not iterable.