ubuntu 使用 Lambda Stack (包含 TensorFlow,Keras,PyTorch,Caffe,Caffe 2)

https://zhuanlan.zhihu.com/p/331457856
Lambda Stack
Ubuntu 20.04, 18.04, 和 16.04
TensorFlow, Keras, PyTorch, Caffe, Caffe 2
CUDA, cuDNN, NVIDIA

install

LAMBDA_REPO=$(mktemp) && \
wget -O${LAMBDA_REPO} https://lambdalabs.com/static/misc/lambda-stack-repo.deb && \
sudo dpkg -i ${LAMBDA_REPO} && rm -f ${LAMBDA_REPO} && \
sudo apt-get update && sudo apt-get install -y lambda-stack-cuda
sudo reboot

update PyTorch、 TensorFlow、 CUDA or cuDNN

sudo apt-get update && sudo apt-get dist-upgrade

test

import tensorflow
tensorflow.__version__

import torch
torch.__version__
# How many GPUs are there?
print(torch.cuda.device_count())
# Which GPU Is The Current GPU?
print(torch.cuda.current_device())
# Get the name of the current GPU
print(torch.cuda.get_device_name(torch.cuda.current_device()))
# Is PyTorch using a GPU?
print(torch.cuda.is_available())

install Docker

2022-05-27 更新

sudo apt-get update && \
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release && \
sudo mkdir -p /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \
sudo apt-get update && \
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin && \
sudo groupadd docker && \
sudo usermod -G docker -a ubuntu && \
newgrp docker && \
groups && \
sudo systemctl restart docker

舊版

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
apt-cache madison docker-ce
sudo apt-get install docker-ce=5:20.10.1~3-0~ubuntu-focal docker-ce-cli=5:20.10.1~3-0~ubuntu-focal containerd.io
# Build a Docker image for Ubuntu 20.04 (focal). You can substitute focal for bionic or xenial to change the ubuntu version.
sudo docker build -t lambda-stack:20.04 -f Dockerfile.focal git://github.com/lambdal/lambda-stack-dockerfiles.git

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *