Can I use the built-in vector type float3 that exists in Cuda documentation with Numba Cuda? I know that is possible to use with PyCuda, for example, a kernel like:
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();
}
}
"""
How could I do the same with Numba Cuda? Thanks!
Can I use the built-in vector type float3 that exists in Cuda documentation with Numba Cuda?
No, you cannot.
Numba CUDA Python inherits a small subset of supported types from Numba's nopython mode. But that is all. There are a lot of native CUDA features which are not exposed by Numba (at October 2021). Textures, video SIMD instructions and vector types are amongst them.