UCL-MIRSG / xnat-aws

Deploy XNAT on AWS
MIT License
2 stars 0 forks source link

Use GPU for the Container Service #51

Open p-j-smith opened 1 year ago

p-j-smith commented 1 year ago

The workshop uses a container that runs some analysis with Fastsurfer. This requires a GPU to run, so we should change the ec2 instance type we're using for the Container Service

p-j-smith commented 1 year ago

I think a GPU is not required, but the analysis will run significantly faster on GPU

p-j-smith commented 1 year ago

Pricing per month if we use CPU vs GPU, and have ec2 instance running continually vs using EKS to launch containers:

Prices are in $USD

This pricing assumes usage of 40 hours per week (8 hours a day times 5 days per week) when running directly on ec2, and 5 hours per week (1 hour per day time 5 days per week) when running via EKS. The cost of running EKS is $73.00 USD per month ($0.10 USD per hour).

So running the analysis on CPU only (without EKS) is the most cost effective (assuming the usage estimates are accurate). In #44 let's see how long the analysis takes to run on the CPU

xnat-aws-container-service-pricing.pdf

milanmlft commented 1 year ago

After some test runs for #44, seems that a GPU is indeed required to run FastSurfer. See also https://github.com/UCL-MIRSG/xnat-aws/issues/67#issuecomment-1678778159

p-j-smith commented 1 year ago

In https://github.com/UCL-MIRSG/xnat-aws/issues/67#issuecomment-1678778159 you said:

...now I'm getting a new one:

Could not create container from image healthbioscienceideas/fastsurfer:gpu

which command was that for? I just tried running Converts NIFTI to 256 conformed MGZ file on the output from Run dcm2niix on a Scan and got this error:

/fastsurfer/nii_to_mgz.sh: line 27: pydeface: command not found
Deface failed
milanmlft commented 1 year ago

I had it from that same command

p-j-smith commented 1 year ago

I just ran the Defaces a T1 Nifti scan command on the same output from Run dcm2niix on a Scan and it ran okay - it took about 13 minutes.

Then I tried running the DEFACED DATA - Converts defaced NIFTI to 256 conformed MGZ file on the defaced output and got the same error:

/fastsurfer/nii_to_mgz.sh: line 27: pydeface: command not found
Deface failed

We could try using the healthbioscienceideas/pydeface:latest tag of the image rather than healthbioscienceideas/pydeface:minify - the minify version must not have pydeface installed

milanmlft commented 1 year ago

Oh, so you got it to run without a GPU?

OK so I got the same error as you now. So it seems we don't need a GPU after all? Not sure why it wasn't working before for me... I did destroy and re-deploy the architecture though, so that might have resolved the Could not create container from image healthbioscienceideas/fastsurfer:gpu problem.

milanmlft commented 1 year ago

Created another issue for this #70

milanmlft commented 1 year ago

Since it doesn't seem essential after all, maybe we could provide it as an option? In #72 I created separate commands to run FastSurfer on a GPU or CPU, so we could let users decide which one they want to use.