NOTE: This page explains how to install Cellpose with GPU support in Miniconda
= Prerequisites =
# Get [[https://docs.conda.io/en/latest/miniconda.html | Miniconda]]
# Get latest [[https://www.geforce.com/drivers|NVIDIA drivers]]
# Get [[https://developer.nvidia.com/cuda-10.0-download-archive|CUDA 10.0 Toolkit]]
# Get [[https://developer.nvidia.com/rdp/cudnn-download|cuDNN for CUDA 10.0]] (Needs you to login)
# Get [[ https://software.intel.com/content/www/us/en/develop/tools/math-kernel-library/choose-download/windows.html | Intel® Math Kernel Library (Intel® MKL) for Windows]]
Everything can be installed with defaults. The only tedious things are to setup CuDNN and some environment variables
== CuDNN ==
CuDNN needs you to copy paste the contents of the zip file you downloaded to
`C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\`
The idea is that the folder hierarchy matches.
|{F13890259, width=400}|{F13890265, width=400} |
|Copy this| into this|
|-----------|-------|
== Environment Variables Setup ==
Run `sysdm.cpl` then {nav Advanced>Environement Variables...}
Create these two variables and add the following paths to them
|VARIABLE NAME | Path (Default) |
|-------------------|-----------------|
|INCLUDE| C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include|
|LIB| C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\lib\x64|
=Installing Cellpose=
CellPose [[ http://www.cellpose.org/static/docs/installation.html | does a good job explaining how to install it ]] using CPU but is a little vague about installing it for GPU.
After all prerequisites are met, you can install CellPose with GPU using the following environment file
`conda env create -p d:\env-cellpose -f PATH_TO\environement.yml`
NOTE: Feel free to replace `-p d:\env-cellpose` with `-n cellpose` but I prefer to install my environments elsewhere than the c:\ drive
== Activating the GPU option ==
Provided you have installed all the prerequisites and used the `environment.yml` file above, you need to do the following inside your newly created environment
```
conda activate d:\env-cellpose
pip uninstall mxnet-mkl
pip install mxnet-cu100 mxnet-cu100mkl
```
==Optional: Clone the cellpose repository ==
In this example, we are cloning it to `d:\cellpose-src`
```
git clone https://github.com/MouseLand/cellpose.git d:\cellpose-src
```
= Testing if this works =
If you cloned the cellpose repository you can use the example notebook to see if everything worked
```
conda activate d:\env-cellpose
d:\
cd cellpose-src
jupyter lab
```
Navigate to the `notebooks` folder and try to run `run_cellpose.ipynb`
Change the second cell to use the GPU
```
model = models.Cellpose(gpu=True, model_type='cyto')
```
Success~
{F13890608, size=full}