Installing deep learning packages¶
Match builds to current GPUs
Choose framework builds that match the GPUs on the current clusters (A100 on Hopper; L40S and H100 on Easley), and check exact package versions before installing.
This step-by-step guide walks through installing deep learning and machine learning tools in a conda environment on CARC systems.
Set up the conda environment¶
-
Load the Anaconda module to get the
condacommand: -
Create a conda environment with a name:
-
Verify the environment was created:
-
Activate the environment:
Install deep learning packages¶
Install one or more of the following, as your work requires.
First make sure Python 3.7 is installed in your current environment:
Then install the K40-compatible build that CARC staged in shared storage, plus the matching CUDA toolkit:
Verify GPU access from PyTorch¶
Run the following Python code on a GPU node (request one first — see example Slurm scripts):
import torch
from torch import nn, tensor
from torch.cuda import device_count
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
x = torch.rand(5, 3)
print(x)
print("Is GPU Available?", torch.cuda.is_available(),
" CUDA device count:", torch.cuda.device_count(),
"current_device:", torch.cuda.current_device())
x = torch.tensor([1, 2, 3], device=device)
y = torch.tensor([1, 4, 9]).to(device)
print(x, y)
print(x + y)
Expected output:
tensor([[0.3220, 0.2174, 0.1226],
[0.7249, 0.8111, 0.8414],
[0.5974, 0.5169, 0.5242],
[0.1436, 0.5150, 0.5688],
[0.3298, 0.1289, 0.5349]])
Is GPU Available? True CUDA device count: 1 current_device: 0
tensor([1, 2, 3], device='cuda:0') tensor([1, 4, 9], device='cuda:0')
tensor([ 2, 6, 12], device='cuda:0')
Additional machine learning packages¶
# OpenCV
conda install -c conda-forge opencv
# numpy, pandas, matplotlib, scikit-learn
conda install numpy pandas matplotlib scikit-learn
Related pages¶
- PyTorch on CARC GPUs
- TensorFlow on CARC GPUs
- Conda channels and pip
- Conda environments in JupyterHub
Migrated from UNM-CARC QuickBytes (last source update 2021-10-15), then restructured with fenced code blocks and curated in this repository. Spotted a problem? Open an issue or pull request.