matlab struct to gpuArray
9 次查看(过去 30 天)
显示 更早的评论
Is it possible to transfer a matlab struct to the GPU? So for example is something like this possible:
s.a = 1
s.b = [1; 2; 3]
s.c = []
s.d = 5
sgpu = gpuArray(s)
0 个评论
采纳的回答
Edric Ellis
2013-4-12
You cannot make a structure on the gpu, but you can make a structure containing gpuArrays.
s.a = gpuArray(1)
s.b = gpuArray([1; 2; 3]);
...
2 个评论
Edric Ellis
2013-4-15
You can use STRUCTFUN to convert a bunch of fields at a time, like this
s.a = magic(3); s.b = magic(4);
gs = structfun(@gpuArray, s, 'UniformOutput', false);
The gpuArray function is indeed currently equivalent to a cudaMemcpy call.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!