[英]Sending variable from CUDA file to CPP file?
I have a CPP project with 1 CUDA file in it. 我有一个CPP项目,其中有1个CUDA文件。
I have a host and device array that I've declared in my CUDA main method 我有一个在CUDA main方法中声明的主机和设备数组
float* h_CovarianceMatrix[11][NumberOfFeatures];
float* d_CovarianceMatrix;
I did a cuda2DMemcpy host to device, did some calculations, and then did a cuda2DMemcpy device to host. 我对设备做了cuda2DMemcpy主机,做了一些计算,然后对主机做了cuda2DMemcpy设备。
So now my h_CovarianceMatrix[][]
is ready to be sent back to my cpp class. 现在,我的
h_CovarianceMatrix[][]
已准备好发送回我的cpp类。
My question is, how do i send this variable to a CPP file from CUDA? 我的问题是,如何从CUDA将此变量发送到CPP文件?
I believe the global symbols declared in the the CUDA source file are visible to the CPP linker. 我相信CUDA源文件中声明的全局符号对CPP链接器可见。 You just need to move the declaration of the matrix symbol into a .h file and include the .h in both the CPP and the CUDA files.
您只需要将矩阵符号的声明移到.h文件中,并将.h包括在CPP和CUDA文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.