How to use GPU only on the nodes that have it

1 回表示 (過去 30 日間)
Maria
Maria 2022 年 2 月 25 日
回答済み: Joss Knight 2022 年 3 月 25 日
Hi,
I have a cluster with 8 nodes, with 4 cores each.
Only node 1 has a GPU. If I launch the command
spmd
gpuDeviceCount("available")
end
I get that the first four labs have answer "1", and the other labs have answer "0. So everything as expected. In the code I want to run, some operations will be performed on the GPU, some others not. I am testing and I tried to create a gpuArray, but I get the following error
>> spmd
gpuArray([2 2 2]);
end
Error detected on workers 9 10 11 12 13 14 15 21 22 23 24 25 26 27 28 29 30 31 32.
Caused by:
Failed to load graphics driver. Unable to load library 'libcuda.so.1'. The error was:
libcuda.so.1: cannot open shared object file: No such file or directory
Update or reinstall your graphics driver. For more information on GPU support, see GPU Support by Release.
How can I tell Matlab that the array shall be created only in the node that has the GPU, namely, node 1 ?
Best
Maria
  1 件のコメント
Ive J
Ive J 2022 年 2 月 25 日
編集済み: Ive J 2022 年 2 月 27 日
what about this?
spmd
if gpuDeviceCount
gpuArray([2 2 2])
else
% do something else
end
end

サインインしてコメントする。

回答 (1 件)

Joss Knight
Joss Knight 2022 年 3 月 25 日
canUseGPU is the favoured way to guard your code.

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by