Exclusively Utilizing NVIDIA GeForce RTX GPU for MATLAB UNet Model Training: Issue with GPU Selection
Show older comments
Hi,
I am using MATLAB to train a UNet model for semantic segmentation purposes on my desktop computer running Windows 11. My computer is equipped with a CPU, GPU 0 (Intel(R) UHD Graphics 770), and GPU 1 (NVIDIA GeForce RTX 3070).
My goal is to exclusively utilize GPU 1 (NVIDIA GeForce RTX 3070) for the training process. To ensure this, I have set the 'ExecutionEnvironment' option in my training parameters to 'gpu'.
However, during training, I've noticed that GPU 1's usage remains at 0%, while the CPU's usage is considerably high. Even when I use the delete(gcp('nocreate')) command in my code, GPU 0 (Intel(R) UHD Graphics 770) only exhibits minor activity at around 1% or 5% usage.
I'm seeking guidance on how to resolve this issue and ensure that my UNet model is trained exclusively using GPU 1. Is there a specific configuration or step that I might be missing? Your assistance in resolving this matter would be greatly appreciated.
7 Comments
Sam Marshalik
on 31 Aug 2023
Hello Gobert, can you please confirm that you have access to Parallel Computing Toolbox? Using a GPU in MATLAB requires that toolbox.
You can see if it is installed via "ver" and if it is licensed by running:
license checkout distrib_computing_toolbox
Gobert
on 31 Aug 2023
Sam Marshalik
on 1 Sep 2023
Edited: Sam Marshalik
on 5 Sep 2023
Thanks, Gobert. Are you seeing any GPU usage on your NVIDIA gpu when running the training, or is it nearly idle the entire time?
You will want to make sure that the parallel pool (parpool) is running when your GPU is being used. You can manually invoke it with the parpool command or let the code automatically trigger that (you will see it light up blue/green when it is on).
EDIT:
Correction to my statement above: You will need a parallel pool only if the GPU resource is remote and you are using MATLAB Parallel Server to connect to it or if you are looking to use parfor to off-load concurrent computations to multiple NVIDIA GPUs at the same time.
Gobert
on 1 Sep 2023
Raymond Norris
on 1 Sep 2023
How many GPU devices does MATLAB report
gpuDeviceCount
If it's one, then MATLAB is probably only seeing the GeForce. But if it's two, then try first calling
gpuDevice(2) % NVIDIA GeForce RTX 3070
Gobert
on 5 Sep 2023
Sam Marshalik
on 5 Sep 2023
@Gobert, let's confirm that you are able to use the GPU device in general. Can you try something like this:
a = rand(100);
aGPU = gpuArray(a);
fft(aGPU)
Does the above command run successfully? Can you try bumping up the size of 'a' and see if you can see your GPU doing something in Task Manager?
Answers (0)
Categories
Find more on Parallel and Cloud in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!