如何复制一个四面体树状结构CUDA设备内存? [英] How to copy a tetrahedron tree structure to CUDA device memory?

查看:120
本文介绍了如何复制一个四面体树状结构CUDA设备内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想移动的结构如下 TetrahedronStruct 来CUDA设备内存,我应该如何进行?

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;

详细内容:

中提供的网格细节(节点,四面体,坐标和区域的数量)。树的建立是在一个for循环完成。基本上,每一个面是位于与它的坐标,并相应地排列在树邻接关系。

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.

在CUDA设备,我需要用这个结构重叠在一个媒体来模拟颗粒将如何跨媒介传播。每百万颗粒被从四面体移动到四面体(每个四面体有其所在媒体的属性)。

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).

推荐答案

这会更容易线性化结构,然后将其复制到设备上。

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

在新的CUDA 6深层副本会容易得多,只要你的计算能力是3.x或更高的的统一内存

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.

这篇关于如何复制一个四面体树状结构CUDA设备内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆