[놀람주의] CUDA가 Python도 지원함
나트륨찡(alphauri)
2022-04-25 05:11
추천 1
https://developer.nvidia.com/cuda-python
https://people.duke.edu/~ccc14/sta-663/CUDAPython.html
CUDA 지원 언어: Python C/C++ Fortran
from numbapro import cuda, vectorize, guvectorize, check_cuda
from numbapro import void, uint8 , uint32, uint64, int32, int64, float32, float64, f8
import numpy as np@cuda.jit('void(float32[:], float32[:], float32[:])')
def cu_add1(a, b, c):
"""This kernel function will be executed by a thread."""
bx = cuda.blockIdx.x # which block in the grid?
bw = cuda.blockDim.x # what is the size of a block?
tx = cuda.threadIdx.x # unique thread ID within a blcok
i = tx + bx * bw
if i > c.size:
return
c[i] = a[i] + b[i]
해당 댓글은 삭제되었습니다.
짱 신기해요...
우리 피카추 잘잤어 ㅇㅅㅇ