jeudi 2 janvier 2020

Is a GPU really more powerfull than a CPU?

I have done a test using CUDA with my laptop. Using the CPU (i7 6700HQ) is at least 20 times more powerful than the 65,000 processors of the GEFORCE 940M inside. While with CUDA it takes about 20 seconds to find 50,000 items over a set of 1 million, the CPU does it in less than 1 second.

What I´m doing wrong? This is the CUDA code (c++):

__global__ void FindFirst(const int items_count, SomeBasicType* data, long target, int* pFound)
{                       
        for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < items_count && *pFound < 0; i += blockDim.x * gridDim.x)
        {               
            if (data[i].Value == target) *pFound = i;
        }
}

Aucun commentaire:

Enregistrer un commentaire