Excerpt |
---|
PyTorch is an optimised tensor library for deep learning using GPUs and CPUs. |
...
$ docker pull quay.io/pawsey/pytorch:2.2.0-rocm5.7.3
The container can be also pulled using singularity:
...
Column |
---|
|
Code Block |
---|
language | bash |
---|
theme | DJango |
---|
title | Terminal 1. Invoking python3 interpreter within the PyTorch container. |
---|
| $ module load pytorch/2.2.0-rocm5.7.3
$ python3
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.2.0a0+git8ac9b20' |
|
Here is another example of running a simple training script on a GPU node during an interactive session:
Column |
---|
|
Code Block |
---|
language | bash |
---|
theme | DJango |
---|
title | Terminal 2. Using PyTorch on a compute node in an interactive Slurm session. |
---|
| setonix-05$ salloc -p gpu -A yourProjectCode-gpu --gres=gpu:1 --time=00:20:00
salloc: Pending job allocation 12386179
salloc: job 12386179 queued and waiting for resources
salloc: job 12386179 has been allocated resources
salloc: Granted job allocation 12386179
salloc: Waiting for resource configuration
salloc: Nodes nid002096 are ready for job
nid002096$ module load pytorch/2.2.0-rocm5.7.3
nid002096$ python3 main.py |
|
Note that when requesting the interactive allocation, users should use their correct project name instead of the "yourProjectCode
" place holder used in the example. Also notice the use of the "-gpu
" postfix to the project name in order to be able to access any partition with GPU-nodes. Please refer to the page Example Slurm Batch Scripts for Setonix on GPU Compute Nodes for a detailed explanation of resource allocation on GPU nodes.
Writing PyTorch code for AMD GPUs
...