How can I check elements of an array are member of the other array?(For using GPU coder)
1 次查看(过去 30 天)
显示 更早的评论
Hi, I'm trying to make a code to use GPU coder and I have a problem with huge matrix.
I have a matrix of 1701*1701*11 double composed with only 0 or 1 and suppose the name of this matrix as A. Also, I have another variable sized matrix. The second matrix has some number within 1~number of elements of the first matrix and I suppose the name of this matrix as B.
I want to check whether the value of A at i-th element from B.
For example, if A is [1 0 0;0 1 0;0 0 1], and B is [2 3 7]. I want to know the values of A at 2nd, 3rd, and 7th element.
For GPU coder app, I cannot use find, ismember, and even indexing.
Does anybody who have an idea which can solve my problem?
0 个评论
回答(1 个)
Walter Roberson
2019-11-28
Your problem is not suitable for coding efficiently on GPU.
It is probably possible to create an algorithm that does do indexing and manages to extract the data (possibly followed by a lot of nan), but the approaches would involve creating large large temporary arrays that would definitely fill up your gpu as you already have problems with running out of memory. The least amount of temporary memory that seems plausible to me at the moment is number of elements in A times number of elements in B, times the (number of bytes in the smallest integer that can store the number of elements in A, plus number of bytes in a logical)
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!