GCP에서 수동으로 만들어도 되지만 아래와 같은 명령어로도 만들 수 있습니다.
해당 명령어는 gcloud를 설치해야 사용 가능합니다.
이 명령어는 europe-west4-a region에서 instance-name이라는 VM 인스턴스 이름을 가진 V3 TPU를 빌리는 과정입니다.
gcloud alpha compute tpus tpu-vm create instance-name --zone europe-west4-a --accelerator-type v3-8 --version tpu-vm-base
V4
gcloud compute tpus tpu-vm create tpu-name \
--zone=us-central2-b \
--accelerator-type=v4-64 \
--version=tpu-ubuntu2204-base
다음과 같은 명령어로 TPU VM에 연결할 수 있습니다.
gcloud compute tpus tpu-vm ssh tpu-name --zone us-central2-b
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install screen
wget https://repo.anaconda.com/archive/Anaconda3-2023.03-Linux-x86_64.sh
sh Anaconda3-2023.03-Linux-x86_64.sh
pip install --upgrade pip
conda install -c anaconda jupyter
conda install -c conda-forge ipykernel
conda install -c conda-forge gdown
pip install jax[tpu] -f https://storage.googleapis.com/jax-releases/libtpu_releases.html
jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --NotebookApp.token=''
# 외부 ip 보는 방법
curl ident.me
conda create -n env_name python=3.8
conda activate env_name
python -m ipykernel install --user --name=env_name
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
sudo apt install libgl1-mesa-glx
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
scipy 설치
sudo apt-get update
sudo apt-get upgrade
pip install --upgrade scipy # conda install scipy