Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues Running Segmentation Model on Windows Platform with cuDNN Errors #62

Open
chocolatetoast-chiu opened this issue Jun 4, 2024 · 1 comment

Comments

@chocolatetoast-chiu
Copy link

Hello!

I've been using this toolkit for a long time, and it has been incredibly helpful for testing deep learning brain tumor segmentation models! Thanks for your hard work 🙏!

Recently, I changed the platform from Ubuntu 20.04 to Windows and set up all the requirements (running all commands in the Anaconda Prompt terminal). Here are the steps I've taken:

  1. Verified Docker and GPU setup:

    docker run --rm --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi

    Docker GPU Setup

  2. Checked WSL version:

    wsl -l -v

    WSL Version

  3. Successfully ran the BraTs Preprocessor in CPU mode and finished preprocessing the example data.

Problem Description

When I attempted to run the segmentation, I encountered issues related to cuDNN:

  1. Using mic-dkfz:

    • Encountered CUDNN_STATUS_MAPPING_ERROR.
      mic-dkfz Error
  2. Using scan-20:

    • Encountered an error stating that a valid cuDNN algorithm could not be found.
      scan-20 Error

To verify the cuDNN installation in the container, I ran the container in interactive mode and printed the package information:

docker run --rm -it --gpus device=0 -v E:\creomed_Leon_BraTS-Toolkit\codes\BraTS-Toolkit\brats_toolkit:/app/data/ brats/scan-20 bash

python3 -c "import torch; print('PyTorch version:', torch.__version__); print('cuDNN version:', torch.backends.cudnn.version()); print('CUDA version:', torch.version.cuda)"

Output:
Package Information

Running nvidia-smi inside the interactive terminal:
nvidia-smi Output

Request for Assistance

I am seeking guidance on whether the segmentation steps are correct for running under the Windows platform. The same process worked fine under Ubuntu, so I suspect there may be different considerations for running the segmentation model with GPU on Windows.

Any insights or suggestions for running the segmentation model with GPU support on Windows would be greatly appreciated.

Thank you!

P.S. Here is my script to run Segmentation

import os
import sys
import time
import datetime
from brats_toolkit.segmentor import Segmentor

# log
starttime = str(datetime.datetime.now().time())
print("*** starting at", starttime, "***")

# specify the folder path
selected_name_path = 'example'
parent_path = "E:\\creomed_Leon_BraTS-Toolkit\\data_BraTs\\"
folder_path = parent_path + "output_preprocessor_single\\" + selected_name_path

# algorithms we used to select for segmentation
cids = ["scan-20"]

for filename in os.listdir(folder_path):
	examName = filename
	print('********** Start processing ' + examName + ' **********')

		
	# input files
	if os.path.isdir(folder_path + "\\" + examName + "\\robex_brats-space\\"):
		t1File = folder_path + "\\" + examName + "\\robex_brats-space\\" + examName + "_robex_brats_t1.nii.gz"
		t1cFile = folder_path + "\\" + examName + "\\robex_brats-space\\" + examName + "_robex_brats_t1c.nii.gz"
		t2File = folder_path + "\\" + examName + "\\robex_brats-space\\" + examName + "_robex_brats_t2.nii.gz"
		flaFile = folder_path + "\\" + examName + "\\robex_brats-space\\" + examName + "_robex_brats_fla.nii.gz"
	elif os.path.isdir(folder_path + "\\" + examName + "\\hdbet_brats-space\\"):
		t1File = folder_path + "\\" + examName + "\\hdbet_brats-space\\" + examName + "_hdbet_brats_t1.nii.gz"
		t1cFile = folder_path + "\\" + examName + "\\hdbet_brats-space\\" + examName + "_hdbet_brats_t1c.nii.gz"
		t2File = folder_path + "\\" + examName + "\\hdbet_brats-space\\" + examName + "_hdbet_brats_t2.nii.gz"
		flaFile = folder_path + "\\" + examName + "\\hdbet_brats-space\\" + examName + "_hdbet_brats_fla.nii.gz"
	else:
		print('********** ERROR: ' + examName + ' doesn\'t be preprocessed successfully **********')
		sys.exit()
		
	# output
	outputFolder = parent_path + "\\output_segmentor\\" + selected_name_path + "\\" + examName + "\\"

	# execute it
	for cid in cids:
		# instantiate
		seg = Segmentor(verbose=True)
		try:
		    outputFile = outputFolder + cid + ".nii.gz"
		    seg.segment(
		        t1=t1File,
		        t2=t2File,
		        t1c=t1cFile,
		        fla=flaFile,
		        cid=cid,
		        outputPath=outputFile,
		    )

		except Exception as e:
		    print("error:", str(e))
		    print("error occured for:", cid)
		    
		seg = []
		
	time.sleep(3)
	print('********** Finished processing ' + examName + ' **********')
@chocolatetoast-chiu
Copy link
Author

[Update]

I also tried to run the segmentation model under wsl2 Ubuntu terminal, the preprocessing using cpu can be run successfully. And the cuDNN algorithm still can't be captured with the scan-20 model.

image

I thought would it be possible for this GPU to be too new to run the inference under the docker container environment? Referring to this packages' versions:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant