Open saileshsidhwani opened 1 year ago
Does export CUDA_VISIBLE_DEVICES=1
before running monailabel start-server command, or run CUDA_VISIBLE_DEVICES=1 monailabel start_server ....
works on the case to avoid using GPU 0?
Gave this a try:
$(Cuda11_3_Torch1_12) PS S:\VirtualEnvs\Windows\Cuda11_3_Torch1_12> $Env:CUDA_VISIBLE_DEVICES = 1
$(Cuda11_3_Torch1_12) PS S:\VirtualEnvs\Windows\Cuda11_3_Torch1_12> $Env:CUDA_VISIBLE_DEVICES
1
$(Cuda11_3_Torch1_12) PS S:\VirtualEnvs\Windows\Cuda11_3_Torch1_12> monailabel start_server --app .\monailabel\sample-apps\radiology\ --studies 'C:\Users\ssidhwan\Desktop\imagesTr\' --conf models segmentation_spleen --conf heuristic_planner true
But ran into the same issue. Looking at this [MainThread] [INFO] (monailabel.utils.others.generic:161) - Using nvidia-smi command
I believe it is using nvidia-smi command to get the available GPU memory. Setting the CUDA_VISIBLE_DEVICES environment variable does not really affect the nvidia-smi output
Thanks for the updates.
Hi @diazandr3s , do you familiar with this planner? Looks like this index is fixed, if possible we can test and update so that users can have flexibility for GPUs.
If this makes sense to you, I can create a PR for this. Thanks!
Thanks for reporting this @saileshsidhwani. Indeed the index is fixed, @tangy5 The heuristic planner defines spacing and ROI. It is still in its early stages though. I'd suggest you use the default ROI and spacing as you have quite a good GPU. @tangy5, the heuristic planner may need some updates to also define pre-transform/data augmentation arguments. Happy to chat more about this.
Describe the bug When using 'heuristic_planner' with the sample radiology app, starting the monailabel server errors out on my system with the following error:
My machine has 2 different GPUs, the first one is a 2GB Quadro P600 and the second one is a 24GB NVIDIA TITAN RTX.
Digging more into this I noticed that the
_get_target_img_size
method inmonailabel.utils.others.planner
class always uses the first GPU on the system to compute available GPU memory for heuristic purposes.This is not ideal as the first GPU on my system is only 2GB and the math in the above function leads to errors. For training/inference, I always set the cuda device to make sure the right GPU is used instead (RTX in my case).
If in the above code, I replace what GPU to use, everything works as expected
gpu_mem = gpu_memory_map()[0]
withgpu_mem = gpu_memory_map()[1]
This leads me to believe that It would be best if I can somehow tell the planner what GPU to use to compute the heuristic.
Server logs
To Reproduce Steps to reproduce the behavior:
Go to On WIndows 10
Install
Run commands
monailabel start_server --app .\monailabel\sample-apps\radiology\ --studies 'C:\Users\ssidhwan\Desktop\imagesTr\' --conf models segmentation_spleen --conf heuristic_planner true
Expected behavior A way to tell heuristic planner on what GPU(s) to use insted of always using the first GPU
Screenshots If applicable, add screenshots to help explain your problem.
Environment
Ensuring you use the relevant python executable, please paste the output of:
Additional context Add any other context about the problem here.