Pointers in FERMI Using pointers in the new architecture

Hi,

I’m trying to understand how it could be done using pointers in the new architecture (FERMI) because I need to use a structure that has pointer and pointer pointers.

Someone could put some code to illustrate?

Pointers are used the same way in CUDA as they are in C.

int v=0;

int *ptr = &v;

*ptr=1;

But maybe you have a specific question.

There is some trickiness and common bugs when you’re trying to mix host and device pointers… you yourself need to track that.

An example might be making a linked list on the host that you plan to memcpy to the device… those pointers inside the links need to be device pointers and it’s easy to confuse.

Hi SPWorley,

For example take a look at this code: Google Code Archive - Long-term storage for Google Code Project Hosting. , it is a CPU code, will need to take this structure to the GPU and work with it inside, I’m trying to understand the advantages and disadvantages of this because a friend told me that perhaps these structures get very inefficient, because on it we will still use a priority queue.

So the question would have something different in use, is a simple question that I’m having to assemble the code in CUDA transposing it already created the code for the CPU.

I greatly appreciate the help.

It has nothing to do with new Fermi architecture. It introduces virtual functions. You may use indexes instead of pointers btw. Data layout and algorythm parallelization are important in your task.

Yes, That part I knowI will have to to change some things, but in the code that I put down I think the changes required will not be taken, where the algorithm I have to make the biggest changes was in the priority queue for example to use through this structure.

struct cell;

typedef struct cell cell;

struct cell

{

    cell *move[DIRECTIONS];

    cell *succ[DIRECTIONS];

    cell *searchtree;

    cell *trace;

    short obstacle;

    int x, y;

    int dfsx, dfsy; /* needed only for generating dfs mazes */

    int g;

    int rhs;

    int key[3];

    int generated;

    int heapindex;

};

/* Note: mazegoal is the start cell. */

/* Note: mazestart is the goal cell. */

cell **maze;

cell *mazestart, *mazegoal;

Plus my big question would be how to use if I am right in what I am doing? And if it would cause some loss of speed by using this structure?