Neurodesktop (https://neurodesk.org) is a flexible, scalable, and browser-based data analysis environment for reproducible neuroimaging. It provides a fully featured destktop in a container allowing users to consume containerised tools enabling researchers to easily create and reproduce analysis.
Neurodesktop can be run in any environment that can run Docker but the real power comes when it can make use of large CPU, memory or GPUs to reduce the analysis time.
In this blog post, I will walk through how to set up a Google Cloud virtual machine to run Neurodesktop with an attached GPU.
First Create a Google Compute Engine (GCE) VM with a connected GPU
Choose or create a new project
Navigate to Compute Engine -> Instances
Select “CREATE INSTANCE”
Configure the Instance
Edit the name of the instance
Choose the Region where you want to run the instance
Choose the GPU option for Machine Configuration
Configure the GPUs
Choose the GPU Type and Number
Note that to the right you can see an estimate of the monthly cost as you choose the configuration.
Also note that depending on the particular GPU chosen, you may need to change zone and/or region to one where those GPUs are available.
Configure the CPU
Choose the CPU Type and number, making sure you have at least 7.5GB RAM
Note that if you cannot find a predefined combination of CPU and memory that is suitable, you can select custom and specify the combination you need.
Configure the O/S and Disk Size
Choose Ubuntu Linux
Version 20.04 LTS x86_64
With 64GB storage (or more if you need it)
Configure Firewall to allow HTTP Traffic
Select “Create”
Wait for the VM to be ready
Configure the instance to run NeuroDesktop
Hit the SSH button to open an SSH Connection to the VM
Install Docker
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable
“
sudo apt-get update -y
sudo apt-get install -y screen docker-ce
sudo systemctl enable –now docker
sudo systemctl status docker
Install NVidia Drivers for the GPU
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2004-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda
Check that the Nvidia Drivers are installed and working properly
nvidia-smi
This should show the GPU as visible
Install nVidia Container Toolkit
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg –dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sed ‘s#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g’ | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update -y
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
Reboot
sudo reboot
Reconnect
Wait a short while and hit the reconnect button
Check that the Nvidia Drivers are installed and working properly
sudo docker run –rm –gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi
This should, once again, show that the GPU is visible (this time inside Docker)
Run Neurodesktop Docker Container
sudo docker run –shm-size=1gb -d –privileged –name neurodesktop-20221012 –restart unless-stopped -v ~/neurodesktop-storage:/neurodesktop-storage -e HOST_UID=”$(id -u)” -e HOST_GID=”$(id -g)” –gpus all -p80:8080 -p 3390:3389 -h neurodesktop-20221012 vnmd/neurodesktop:20221012
Return to the Google Cloud Console
Wait a minute for the Docker container to start then hit the external address on the VM Instance
Test the environment
A new Tab will open with the login screen
Login with the default username: “user” and password: “password”
Open the Desktop
Open a terminal window
Give permissions to the shared folder
sudo chmod 777 /neurodesktop-storage
Check we have access to the gpu
nvidia-smi
Recent Comments