Select a GPU to be used by a function running in parallel(parfeval)

조회 수: 11 (최근 30일)
Tutu
Tutu 2019년 8월 16일
댓글: Tutu 2019년 8월 21일
Hello,
I am using two GPUs in a GUI postprocessing images live.
I am using the 'FramesAcquiredFcn' as a hub to transfer data from the buffer to the CPU RAM memory ('getdata') and launch a 'parfeval' function on GPU postprocessing these data. I have 1 pool with 3 workers initialized (one for the 'FramesAcquiredFcn' and one for each GPU). I can check that when the 'parfeval' function is not finished at the next iteration the second GPU is used instead. Now, I know that using 'wait' I can force the first GPU to be used.
However, I would like to split my postprocessing between these two GPUs because one is more powerful than the other. Hence, I would need the first 'parfeval' function to use the GPU1 pass the outputs (using 'afterEach'?) to an other parfeval function using the GPU2.
I have read the 'help selectGPU' but could not figure out how to modify it for my purpose.
Any help will be welcome.

채택된 답변

Joss Knight
Joss Knight 2019년 8월 18일
I'd have to know what kind of postprocessing you're doing - please post some code. On the face of it, the answer is simply to use gpuDevice(i) to select a particular device for each of your parfeval calls.
  댓글 수: 7
Joss Knight
Joss Knight 2019년 8월 21일
You can use a third-party scheduler and give it the properties you like, but I suspect that is not really what you're after. I think the real issue here is that MATLAB has no way to switch devices without resetting the device, which is slow; this is something we intend to improve.
You may be able to use client/worker parallelism here. Do your front-end work on the client on one GPU and dispatch your background work to a single worker that has the other GPU selected (or multiple GPUs all of which have the other GPU selected, if that's appropriate).
Tutu
Tutu 2019년 8월 21일
Thanks Joss Knight for your answer. It is not what I am after, but I understand as well that MATLAB has not yet implemented this option without reseting the whole device. It is what I needed to know.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by