You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void __global__ add(const real *d_x, const real *d_y, real *d_z)
{
const int n = blockDim.x * blockIdx.x + threadIdx.x;
if (n < N1)
{
for (int i = 0; i < 100000; ++i)
{
d_z[n] = d_x[n] + d_y[n];
}
}
}
The text was updated successfully, but these errors were encountered:
void __global__ add(const real *d_x, const real *d_y, real *d_z)
{
const int n = blockDim.x * blockIdx.x + threadIdx.x;
if (n < N1)
{
for (int i = 0; i < 100000; ++i)
{
d_z[n] = d_x[n] + d_y[n];
}
}
}
在本书的第129页,Listing 11.2 中列举了本章程序 kernel-kernel.cu 的部分内容。
另外,在书本的第130页,第二段的末尾,您也说明,“为了计时方便,核函数中故意做了10^6次加法运算。”
但是,在Github相应的代码库中(CUDA-Programming/src/11-stream/kernel-kernel.cu),我们可以发现,其中的
add
函数仅仅增加了10^5次,也就是说,您展示于库中的代码,与书本展示的代码并不匹配。The text was updated successfully, but these errors were encountered: