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!