简体   繁体   English

从c ++到OpenCL的指针

[英]Pointers from c++ to OpenCL

Basicly, i have a struct like this: 基本上,我有这样的结构:

struct MyStruct
{
    MyStruct *foo[8];
}

Now (how) can I load this up to the OpenCL memory? 现在(如何)可以将其加载到OpenCL内存中? Will c++ pointers be valid in OpenCL and are they pointing to the object they used to on CPU-Level? c ++指针在OpenCL中是否有效,它们是否指向以前在CPU级别使用的对象?

Your pointer is relevant on the memory where it is used. 您的指针与使用它的内存有关。

An OpenCL device has its own memory, then an address from host memory differs from the device memory. OpenCL设备拥有自己的内存,因此主机内存中的地址与设备内存不同。

You have to transfer your data in a buffer then pass the buffer to the kernel(s). 您必须在缓冲区中传输数据,然后将缓冲区传递给内核。

This post could interest you : passing array of structs to the kernel in open CL 这篇文章可能会让您感兴趣: 在开放式CL中将结构数组传递给内核

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM