Skip to content
Snippets Groups Projects
Commit 31f5bdb1 authored by Natalie Breidenbach's avatar Natalie Breidenbach
Browse files

Update pytorch.md

parent 028bc4dd
No related branches found
No related tags found
2 merge requests!938Automated merge from preview to main,!936Update to Five-Cluster-Operation
...@@ -15,18 +15,23 @@ marie@login$ module spider pytorch ...@@ -15,18 +15,23 @@ marie@login$ module spider pytorch
to find out, which PyTorch modules are available. to find out, which PyTorch modules are available.
We recommend using partitions `alpha` and/or `ml` when working with machine learning workflows We recommend using the cluster `alpha` and/or `power` when working with machine learning workflows
and the PyTorch library. and the PyTorch library.
You can find detailed hardware specification in our You can find detailed hardware specification in our
[hardware documentation](../jobs_and_resources/hardware_overview.md). [hardware documentation](../jobs_and_resources/hardware_overview.md).
_The module environments /hiera, /scs5, /classic and /ml originated from the taurus system are momentarily under construction. The script will be updated after completion of the redesign accordingly_
## PyTorch Console ## PyTorch Console
On the partition `alpha`, load the module environment: On the cluster `alpha`, load the module environment:
```console ```console
# Job submission on alpha nodes with 1 gpu on 1 node with 800 Mb per CPU # Job submission on alpha nodes with 1 gpu on 1 node with 800 Mb per CPU
marie@login$ srun -p alpha --gres=gpu:1 -n 1 -c 7 --pty --mem-per-cpu=800 bash
marie@login.alpha$ srun --gres=gpu:1 -n 1 -c 7 --pty --mem-per-cpu=800 bash
marie@alpha$ module load modenv/hiera GCC/10.2.0 CUDA/11.1.1 OpenMPI/4.0.5 PyTorch/1.9.0 marie@alpha$ module load modenv/hiera GCC/10.2.0 CUDA/11.1.1 OpenMPI/4.0.5 PyTorch/1.9.0
Die folgenden Module wurden in einer anderen Version erneut geladen: Die folgenden Module wurden in einer anderen Version erneut geladen:
1) modenv/scs5 => modenv/hiera 1) modenv/scs5 => modenv/hiera
...@@ -34,9 +39,9 @@ Die folgenden Module wurden in einer anderen Version erneut geladen: ...@@ -34,9 +39,9 @@ Die folgenden Module wurden in einer anderen Version erneut geladen:
Module GCC/10.2.0, CUDA/11.1.1, OpenMPI/4.0.5, PyTorch/1.9.0 and 54 dependencies loaded. Module GCC/10.2.0, CUDA/11.1.1, OpenMPI/4.0.5, PyTorch/1.9.0 and 54 dependencies loaded.
``` ```
??? hint "Torchvision on partition `alpha`" ??? hint "Torchvision on the cluster `alpha`"
On the partition `alpha`, the module torchvision is not yet available within the module On the cluster `alpha`, the module torchvision is not yet available within the module
system. (19.08.2021) system. (19.08.2021)
Torchvision can be made available by using a virtual environment: Torchvision can be made available by using a virtual environment:
...@@ -49,46 +54,46 @@ Module GCC/10.2.0, CUDA/11.1.1, OpenMPI/4.0.5, PyTorch/1.9.0 and 54 dependencies ...@@ -49,46 +54,46 @@ Module GCC/10.2.0, CUDA/11.1.1, OpenMPI/4.0.5, PyTorch/1.9.0 and 54 dependencies
Using the **--no-deps** option for "pip install" is necessary here as otherwise the PyTorch Using the **--no-deps** option for "pip install" is necessary here as otherwise the PyTorch
version might be replaced and you will run into trouble with the CUDA drivers. version might be replaced and you will run into trouble with the CUDA drivers.
On the partition `ml`: On the cluster `power`:
```console ```console
# Job submission in ml nodes with 1 gpu on 1 node with 800 Mb per CPU # Job submission in power nodes with 1 gpu on 1 node with 800 Mb per CPU
marie@login$ srun -p ml --gres=gpu:1 -n 1 -c 7 --pty --mem-per-cpu=800 bash marie@login.power$ srun --gres=gpu:1 -n 1 -c 7 --pty --mem-per-cpu=800 bash
``` ```
After calling After calling
```console ```console
marie@login$ module spider pytorch marie@login.power$ module spider pytorch
``` ```
we know that we can load PyTorch (including torchvision) with we know that we can load PyTorch (including torchvision) with
```console ```console
marie@ml$ module load modenv/ml torchvision/0.7.0-fossCUDA-2019b-Python-3.7.4-PyTorch-1.6.0 marie@power$ module load modenv/ml torchvision/0.7.0-fossCUDA-2019b-Python-3.7.4-PyTorch-1.6.0
Module torchvision/0.7.0-fossCUDA-2019b-Python-3.7.4-PyTorch-1.6.0 and 55 dependencies loaded. Module torchvision/0.7.0-fossCUDA-2019b-Python-3.7.4-PyTorch-1.6.0 and 55 dependencies loaded.
``` ```
Now, we check that we can access PyTorch: Now, we check that we can access PyTorch:
```console ```console
marie@{ml,alpha}$ python -c "import torch; print(torch.__version__)" marie@{power,alpha}$ python -c "import torch; print(torch.__version__)"
``` ```
The following example shows how to create a python virtual environment and import PyTorch. The following example shows how to create a python virtual environment and import PyTorch.
```console ```console
# Create folder # Create folder
marie@ml$ mkdir python-environments marie@power$ mkdir python-environments
# Check which python are you using # Check which python are you using
marie@ml$ which python marie@power$ which python
/sw/installed/Python/3.7.4-GCCcore-8.3.0/bin/python /sw/installed/Python/3.7.4-GCCcore-8.3.0/bin/python
# Create virtual environment "env" which inheriting with global site packages # Create virtual environment "env" which inheriting with global site packages
marie@ml$ virtualenv --system-site-packages python-environments/env marie@power$ virtualenv --system-site-packages python-environments/env
[...] [...]
# Activate virtual environment "env". Example output: (env) bash-4.2$ # Activate virtual environment "env". Example output: (env) bash-4.2$
marie@ml$ source python-environments/env/bin/activate marie@power$ source python-environments/env/bin/activate
marie@ml$ python -c "import torch; print(torch.__version__)" marie@power$ python -c "import torch; print(torch.__version__)"
``` ```
## PyTorch in JupyterHub ## PyTorch in JupyterHub
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment