Translate Struct for CUDA

Hi,

I’m having some trouble turning a Struct to a format that can be run on the GPU, but not

I have no idea how to do this, the code is as follows:

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;

};

cell **maze;

cell *mazestart, *mazegoal;

I noticed that I can do so by referencing the struct inside itself, as here, cell *trace, but do not know how anyone could help me?

Thank you in advance for your help.

Hi,

I’m having some trouble turning a Struct to a format that can be run on the GPU, but not

I have no idea how to do this, the code is as follows:

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;

};

cell **maze;

cell *mazestart, *mazegoal;

I noticed that I can do so by referencing the struct inside itself, as here, cell *trace, but do not know how anyone could help me?

Thank you in advance for your help.

What exactly is your problem? I can’t see anything that would not work on the GPU.

However, as you usually do not want to do dynamic memory allocations (and can’t do them on pre-Fermi hardware), it usually is simpler and faster to use arrays instead of lists and array indices instead of pointers.

What exactly is your problem? I can’t see anything that would not work on the GPU.

However, as you usually do not want to do dynamic memory allocations (and can’t do them on pre-Fermi hardware), it usually is simpler and faster to use arrays instead of lists and array indices instead of pointers.

It’s just that I know that this Struct does not run the plates before Fermi, and therefore this dynamic allocation

can not be done and so I’m trying to understand how this would be to run these devices Struct more old.

What I would like to see to try to understand how the structure would be to run well on the GPU. Other information that might help is that struct will run an algorithm traversal style A *.

It’s just that I know that this Struct does not run the plates before Fermi, and therefore this dynamic allocation

can not be done and so I’m trying to understand how this would be to run these devices Struct more old.

What I would like to see to try to understand how the structure would be to run well on the GPU. Other information that might help is that struct will run an algorithm traversal style A *.

Do not know if I make myself clear in the last reply, but the dynamic allocation Struct this is a linked list! And I wanted

whether this can be done in the FERMI, as far as I know there is no way, or am I wrong?

CUDA has pointers just as normal C does, so this struct can be used on any CUDA capable GPU. The question is, how the memory for the linked list is allocated. On pre-Fermi GPUs, it has to be allocated from host code (or you have to run your own allocator on the device that hands out small pieces of a chunk of memory previously allocated from host code). On Fermi, memory allocations are possible directly from device code.

However, most likely it will just be more efficient to use an array instead of a linked list. What are your specific reasons for wanting a linked list?

Do not quite understand that part!

Answering the question:

In particular, for use i just got reason to be more relaxed, it was thus implemented in the CPU, because I have multiple cells and is easier than pointing them to an array that receives the position where they are and I have to walk up to read them.

My file is full maze.h here below (take a look!):

#ifndef MAZEH

#define MAZEH

#include "include.h"

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; 

int mazeiteration;

void newrandommaze();

void newdfsmaze(int wallstoremove);

#endif

Thanks again for your help.

Still do not understand whether I can run this structure in the Fermi’s?

Sorry I don’t understand what your question is.
A struct is a data structure and as such does not ‘run’ on the GPU, but may be used by code that runs on the GPU.
I’ve also looked at your file maze.h and don’t see anything that would not work on the GPU. Can you post some code (consisting of both data structures and the program code that uses them) together with a concrete question?

You already told me not need to change the file so I can use it as is, will change the rest of my code and I’ll ask for help here to use it, I have a 480 GTX in hand should run well on it.

Thanks so much…