How to select GPU when doing thread-based parallel?
古いコメントを表示
Hi,
I am running programs using multiple GPUs that are shared with other users in our university's super computer. To improve speed, I run programs parallelly in many workers. I would like to put more workers to GPUs that are freer, and less on GPUs that are busier. For example, I would like 4 workers to use a GPU that is 100% free, and 2 workers to a GPU that has 50% occupied by another user.
I know how to do this when I use process-based pool. I can assign a GPU to a worker by doing:
spmd
gpuDevice(GPUindex(labindex));
end
But I do not know how to do it using thread-based pool, i.e., a pool generated using
parpool("threads");
Using spmd is not available for a thread-based pool.
I would really appreciate your input on this. Thanks.
3 件のコメント
Walter Roberson
2022 年 7 月 12 日
gpuArray does not appear to be supported on thread-based pools. https://www.mathworks.com/help/matlab/referencelist.html?type=function&capability=threadsupport
Renping Li
2022 年 7 月 12 日
Edric Ellis
2022 年 7 月 12 日
gpuArray should be documented as working on thread-based pools, thanks for pointing out this omission.
採用された回答
その他の回答 (1 件)
B. S.
2022 年 10 月 26 日
0 投票
Hi,
Please, how can I use your solution in a thread-based parfor pool to get thread ID ? Basically said, the code looks like the following:
parpool('Threads',8);
parfor i=1:100
A(,:,:,i)=rand(2,2)^i;
Thread_Id(i)= ??? % I want to get thread ID for each i and store them in a vector for later use.
end
Thank you in advance for your kind reply.
カテゴリ
ヘルプ センター および File Exchange で Parallel Computing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!