【问题标题】:Built-in Vector Types in Numba CudaNumba Cuda 中的内置向量类型
【发布时间】:2021-11-26 05:40:11
【问题描述】:

我可以将 Cuda 文档中存在的内置向量类型 float3 与 Numba Cuda 一起使用吗?我知道这可以与 PyCuda 一起使用,例如,像这样的内核:

addarrs_codetext = """
__global__ void add_3darrs_broadcast(float3 *out, float3 *a, float3 *b, int* SZ)
{
    const int M = SZ[0];
    const int N = SZ[1];
    const int S = SZ[2];
    const int tx = threadIdx.x;
    const int bx = blockIdx.x;
    const int BSZ = blockDim.x;
    int t;
    for (int s=0;s<S;s++)
    {
        t = s*BSZ+tx;
        if(t<N)
            dest[bx*N+t].x = b[t].x + a[bx].x;
            dest[bx*N+t].y = b[t].y + a[bx].y;
            dest[bx*N+t].z = b[t].z + a[bx].z;
        __syncthreads();
    }
}
"""

我怎么能对 Numba Cuda 做同样的事情? 谢谢!

【问题讨论】:

    标签: python cuda numba


    【解决方案1】:

    我可以将 Cuda 文档中存在的内置向量类型 float3 与 Numba Cuda 一起使用吗?

    不,你不能。

    Numba CUDA Python 从 Numba 的 nopython 模式继承 small subsetsupported types。但仅此而已。 Numba(2021 年 10 月)未公开许多原生 CUDA 功能。纹理、视频 SIMD 指令和矢量类型都在其中。

    【讨论】:

    • 感谢您的回复! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-28
    • 2021-07-24
    • 2020-12-22
    • 2020-02-23
    • 1970-01-01
    • 2017-06-07
    相关资源
    最近更新 更多