필터 지우기
필터 지우기

How can I use the GPU accelerated imdilate function for 3D logical Arrays?

조회 수: 2 (최근 30일)
Nils de Koff
Nils de Koff 2017년 3월 23일
답변: Simão Faria 2018년 3월 28일
At the moment I am developing a region growing algorithm in which I use the imdilate function to iterative expand the region of interest. From a performance test I noticed that I use the imdilate function numerous times during the process, which took 80% of my computational time. Therefore, I wanted to accelerate the region growing algorithm by using the graphic processing unit (GPU) for the whole process. However, the imdilate function does not support three-dimensional structuring elements for gpuArrays.
So the question is: How can I use the GPU accelerated imdilate function for 3D logical Arrays?
Example code:
A = rand(300,300,250);
B = A < 0.2;
D = imdilate(B, true(3,3,3)); % CPU method
B2 = gpuArray(B);
D2 = imdilate(B2, true(3,3,3)); % GPU method that does not work
D3 = imdilate(imdilate(imdilate(B2, true(3,1,1)), true(1,3,1)), true(1,1,3)); % second GPU method that does not work

답변 (1개)

Simão Faria
Simão Faria 2018년 3월 28일
D2 = imdilate(B2, true(3,3,3,'gpuArray'));
Both the matrix and the kernel should be gpuArrays

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by