pyccel / pyccel-cuda

Cuda extension to pyccel
MIT License
1 stars 0 forks source link

thread indexing. #43

Open bauom opened 4 months ago

bauom commented 4 months ago

Adding support to Cuda thread indexing.

example:

from pyccel.decorators import kernel, types
from pyccel import cuda

@kernel
@types('int[:]')
def func(a):
    i = cuda.threadIdx(0) + cuda.blockIdx(0) * cuda.blockDim(0)
    print("Hello World! ", a[i])

The aim is to add the support of ( threadIdx, blockIdx, blockDim )

https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#thread-hierarchy https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#built-in-variables