Из add 3,0164 мс (используйте nvprof)


Код: Выделить всё
#include
#include
// Kernel function to add the elements of two arrays
__global__
void add(int n, float *x, float *y)
{
int index = threadIdx.x;
int stride = blockDim.x;
for (int i = index; i < n; i += stride)
y[i] = x[i] + y[i];
}
int main(void)
{
int N = 1
Подробнее здесь: [url]https://stackoverflow.com/questions/79317982/in-vector-addition-why-did-the-efficiency-not-improve-despite-increasing-the-nu[/url]
Мобильная версия