0
votes

I am new to CUDA and parallelism. I am looking to get some understanding. You should be familiar with the standard SumArrayOnGPU :

__global__ void
vectorAdd(const float *A, const float *B, float *C, int numElements)
{
    int i = blockDim.x * blockIdx.x + threadIdx.x;

    if (i < numElements)
    {
        C[i] = A[i] + B[i];
    }
}

What i am looking to do is continually increment a number, run that number through a arbitrary mesh, and only care about the incremented number that returned me a specific answer.

So, the parallelism would be running the same routine on the incremented number.

  1. Is something like this possible?
  2. What would be the proper logic?
  3. Does it still need to be placed into an array setup?

Thought Example :

__global__ void
vectorfind(long long unsigned *nbr, int numElements)
{
    long long unsigned tnbr;

    int i = blockDim.x * blockIdx.x + threadIdx.x;

    if (i < numElements)
    {
        tnbr = nbr + i;
        tnbr = hash(tnbr);
        if (tnbr = arbitraryresult) { printf("found");
    }
}
1
it is not clear to me what you want to do; what is the problem of your "Thought Example" ?m.s.
the nbr that i am passing in is a starting point. Then, i want to iterate from that starting point. So, i start at say 500,000,000 and i want to iterate 100,000 times. So, it would be 500,000,000 + 1,2 ..... up to +100,000 . I then want to run that incremented number through a hash routine. I then want to check the result to see if it matches a set value.. Does that make sense? Is my thought process correct? Is there a flaw in my thinking?John Styles
Your idea seems correct. The idea is to find a hashed integer by brute force calculation. But why didn't you just try it?havogt
Okay, initial tests seem to be good.John Styles

1 Answers

1
votes

I wanted to make sure that the logic was sound. Thanks to a couple users responses, I have gotten my answer that the logic is okay. I wanted to post this so as to not have a hanging question.