0

If I want to move the below structure TetrahedronStruct to CUDA device memory, how should I proceed?

struct TetrahedronStruct {
  int index;
  int region;
  TriangleFaces Faces[4];
  Vertex Vertices[4];
  struct TetrahedronStruct *adjTetrahedrons[4];
};

typedef struct {
  long double Nx, Ny, Nz;
  long double d;
  Vertex V[3];
} TriangleFaces;

typedef struct {
  long double x, y, z;
} Vertex;

Details:

The mesh details (number of nodes, tetrahedrons, coordinates, and regions) are provided. The creation of the tree is done in a for-loop. Basically, each face is being located and arranged in the tree accordingly with its coordinates and adjacency.

In the CUDA device, I need to use this structure to overlay on a media to simulate how particles will travel across that media. Each of the million particles are moving from tetrahedron to tetrahedron (each tetrahedron has the properties of the media where it resides).

mrei
  • 121
  • 14
  • @talonmies I will search to do what you suggest here: http://stackoverflow.com/questions/6564016/how-to-perform-deep-copying-of-struct-with-cuda?rq=1 Thanks! – mrei Feb 02 '14 at 20:06
  • There isn't enough information here to be able to constructively answer this. Explain how the structure was allocated in host memory and what the objective is on the device once you have it in CUDA device memory. – talonmies Feb 02 '14 at 21:41

1 Answers1

0

It will be easier to linearize the structures and then copy them to device.

In the new CUDA 6 deep copies will be much easier as long as your compute capability is 3.x or higher with the Unified Memory.

mrei
  • 121
  • 14