How to copy a tetrahedron tree structure to CUDA device memory?(如何将四面体树结构复制到 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 设备内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将四面体树结构复制到 CUDA 设备内存?


基础教程推荐
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 常量变量在标题中不起作用 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30