Skip to content

Latest commit

 

History

History
122 lines (104 loc) · 4.97 KB

O2_install.md

File metadata and controls

122 lines (104 loc) · 4.97 KB

Installing the Computer Vision Repository on the O2 High-Performance Computing Cluster

Request GPU partition and load the python 3.10 module

  1. Log in to the O2 cluster using your Harvard Medical School credentials combined with two-factor authentication. Follow the instructions provided on the O2 WIKI page.
  2. Request an interactive partition with GPU. Execute the commands below to access a list of available GPU cards and submit an interactive GPU job using the srun command.
sinfo  --Format=nodehost,available,memory,statelong,gres:40 -p gpu

Request an interactive GPU partition with one CPU core and 32GB of memory for three hours (change this accordingly):

srun -p gpu -c 1 -t 0-3:00 --pty --mem 32G --gres=gpu:1 /bin/bash
  1. Confirm your access to the GPU by using the nvidia-smi command.
nvidia-smi

The output will indicate the current NVIDIA driver version in the top left corner. To run CUDA 12.1.x, this version must be at least 525.60.13, as specified NVIDIA CUDA Toolkit Release Notes.

Please note that some older GPU servers may not have updated to the required GPU driver version and can fail the CUDA tests. However, this does not affect the installation process, as the test will succeed on a GPU with the required driver version. If needed, you can request a specific GPU card, such as the Tesla M40:

srun -p gpu -c 1 -t 0-3:00 --pty --mem 32G --gres=gpu:teslaM40:1 /bin/bash
  1. Load a module for the recommended Python version. You can obtain a list of available Python versions using the module spider command. Load Python 3.10.11 (recommended version for the computer vision repository) as follows:
module load python/3.10.11

Install the Pipenv package manager tool

  1. Install pipenv using pipx to create a virtual environment for the dependencies specified in the Pipfile. Make sure that the correct Python version (3.10.11) is in use. The command: which python should return the correct version number. Pipx creates an isolated python environment to run Python applications.
python -m pip install -U --user pipx

If the pipx command is not available, extend your PATH variable in the bash_profile to include the ~/.local/bin directory:

# Run pipx with --help flag
pipx --help

# If "command not found" error occurs, the add $HOME/.local/bin to your PATH variable
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bash_profile

# Activate the new profile setting
source ~/.bash_profile
  1. Install pipenv in its own environment within your home directory.
pipx install pipenv
  1. Clone the computer vision repository and install it and its dependencies into a pipenv virtual environment.
# Clone the computer vision repository
git clone git@github.com:ccb-hms/computervision.git

Install the python dependencies into the project root:

# Navigate into the project repository
cd computervision

# Create a hidden .venv folder. This is where the python packages for the project will be installed
mkdir .venv

# Install the computervision package along with all dependencies as defined in the Pipfile
# Pipenv will use the .venv folder for the virtual environment
pipenv install -e . --python=3.10.11

If you plan to run the Jupyter Lab server from the new environment, install the dev dependencies:

pipenv install --dev

To install Detectron2, make sure that you are in the computervision directory: pwd prints the current directory. Compiliation of the detectron library requires gcc & g++ version > 7. Therefore, before running the detectron2 installation script, a suitable gcc module should be loaded:

module load gcc/9.2.0

Then, run the detectron install script from the project root:

bash ./bash_scripts/install_detectron

Test the package installation

You can test the successful installation of the computervision package, including the Detectron2 library by running pytest from root of the project directory:

pipenv run python -m pytest

Upon successful installation and test run, the test session should complete without any errors. The output after running the tests should look like this:

Running Jupyter Lab on the O2 portal

To run the Jupyter notebooks in the computervision/notebooks directory, we recommend creating a Jupyter lab session from the O2portal.

The tool can be directed to start a Jupyter Lab server using the python environment that you just created from above.